jan
jan

Reputation: 125

Which function to use for thumbnail creation imagecopyresampled() or imagecopyresized()?

i'm building a image uploading functionality in my website which gives users the possibility to upload a picture of any size to the website. This picture gets automatically resized to a thumbnail size. I've browsed around for some code and i see some using the imagecopyresampled() function to resize and some the imagecopyresized(). Which one is the best to use? What are the differences?

Upvotes: 4

Views: 1609

Answers (1)

Charlie
Charlie

Reputation: 1082

imagecopyresized() copies a rectangular portion of one image to another image. dst_image is the destination image, src_image is the source image identifier.

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.

php.net is your friend

That seemed overly snarky. Sorry about that. Personally I always use imagecopyresampled()

Upvotes: 4

Related Questions