imagecreatefromgd2part

(PHP 4 >= 4.0.7, PHP 5, PHP 7)

imagecreatefromgd2part锟接革拷锟斤拷锟斤拷 GD2 锟侥硷拷锟斤拷 URL 锟叫的诧拷锟斤拷锟铰斤拷一图锟斤拷

说锟斤拷

imagecreatefromgd2part ( string $filename , int $srcX , int $srcY , int $width , int $height ) : resource

Create a new image from a given part of GD2 file or URL.

Tip

锟斤拷锟斤拷锟斤拷锟斤拷fopen 锟斤拷装锟斤拷锟斤拷锟节此猴拷锟斤拷锟叫o拷 URL 锟斤拷锟斤拷为锟侥硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街革拷锟斤拷募锟斤拷锟斤拷锟斤拷 fopen()锟斤拷锟斤拷锟斤拷 wapper 锟侥诧拷同锟斤拷锟斤拷锟斤拷渭锟� 支锟街碉拷协锟斤拷头锟阶靶拷锟�锟斤拷注锟斤拷锟斤拷锟矫凤拷锟斤拷锟斤拷锟斤拷峁╋拷锟皆わ拷锟斤拷锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷

filename

Path to the GD2 image.

srcX

x-coordinate of source point.

srcY

y-coordinate of source point.

width

源图锟斤拷目锟饺★拷

height

源图锟斤拷母叨取锟�

锟斤拷锟斤拷值

锟缴癸拷锟襟返伙拷图锟斤拷锟斤拷源,失锟杰后返伙拷 FALSE 锟斤拷

锟斤拷锟斤拷

Example #1 imagecreatefromgd2part() example

<?php
// For this example we need the image size before
$image getimagesize('./test.gd2');

// Create the image instance now we got the image 
// sizes
$im imagecreatefromgd2part('./test.gd2'44, ($image[0] / 2) - 6, ($image[1] / 2) - 6);

// Do an image operation, in this case we emboss the 
// image if PHP 5+
if(function_exists('imagefilter'))
{
    
imagefilter($imIMG_FILTER_EMBOSS);
}

// Save optimized image
imagegd2($im'./test_emboss.gd2');
imagedestroy($im);
?>

注锟斤拷

Note: 锟剿猴拷锟斤拷锟斤拷要 GD 2.0.1 锟斤拷锟斤拷甙姹�(锟狡硷拷 2.0.28 锟斤拷锟斤拷锟竭版本)锟斤拷

Warning

Windows 锟芥本锟斤拷 PHP 锟斤拷 4.3.0 锟斤拷之前锟斤拷支锟斤拷通锟斤拷锟剿猴拷锟斤拷锟斤拷锟斤拷远锟斤拷锟侥硷拷锟斤拷锟斤拷使锟窖撅拷锟斤拷锟斤拷 allow_url_fopen.