PHP » PYTHON |
login |
register |
about
|
imagecopyresampled(PHP 4 >= 4.0.6, PHP 5) imagecopyresampled — Copy and resize part of an image with resampling Description
bool imagecopyresampled
( resource $dst_image
, resource $src_image
, int $dst_x
, int $dst_y
, int $src_x
, int $src_y
, int $dst_w
, int $dst_h
, int $src_w
, int $src_h
)
imagecopyresampled() copies a rectangular portion of one image to another image, smoothly interpolating pixel values so that, in particular, reducing the size of an image still retains a great deal of clarity. In other words, imagecopyresampled() will take an rectangular area from src_image of width src_w and height src_h at position (src_x ,src_y ) and place it in a rectangular area of dst_image of width dst_w and height dst_h at position (dst_x ,dst_y ). If the source and destination coordinates and width and heights differ, appropriate stretching or shrinking of the image fragment will be performed. The coordinates refer to the upper left corner. This function can be used to copy regions within the same image (if dst_image is the same as src_image ) but if the regions overlap the results will be unpredictable. Parameters
Return ValuesReturns TRUE on success or FALSE on failure. Examples
Example #1 Simple example This example will resample an image to half its original size.
<?php The above example will output something similar to: ![]()
Example #2 Resampling an image proportionally This example will display an image with the maximum width, or height, of 200 pixels.
<?php The above example will output something similar to: ![]()
Notes
See Alsoimagecopyresized() - Copy and resize part of an image |
more
Recently updated
more
Most requested
more
Last requests
|