Matthew Starkey
Matthew Starkey

Reputation: 757

php GD Library imagecopyrezised()

I am using the following line to resize an image file:

imagecopyresized($dst_image, $dst_image, 0, 0, 0, 0, 1000, 750, $src_w, $src_h

I am expecting the values of 1000 and 750 to be the dimensions of the new image file, but instead, an image is being created with the same dimensions as the original file, and copying a section of this image back onto it.

Could anyone help?

Upvotes: 0

Views: 41

Answers (1)

Martin Hujer
Martin Hujer

Reputation: 168

You should create a new image source and copy the image in there:

$resized = imagecreatetruecolor(1000, 750);
imagecopyresized($resized, $dst_image, 0, 0, 0, 0, 1000, 750, $src_w, $src_h)

See the docs: php.net/imagecopyresized

Upvotes: 1

Related Questions