php imagecopyresized vs imagecopyresampled vs imagecopy pros/cons

PhpImageCopyGd

Php Problem Overview


These all seem to do the same thing. What are the pros/cons of each.

imagecopyresized() vs imagecopyresampled() vs imagecopy().

I'm resizing a user submitted image.

So I have an image shell created with '$newImage=imagecreatetruecolor(250, 250)'.

And now I want to copy the orginal image into the '$newImage'

Php Solutions


Solution 1 - Php

imagecopyresized will copy and scale and image. This uses a fairly primitive algorithm that tends to yield more pixelated results.

imagecopyresampled will copy and scale and image, it uses a smoothing and pixel interpolating algorithm that will generally yield much better results then imagecopyresized at the cost of a little cpu usage.

imagecopy will copy but will not scale the image.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionseamusView Question on Stackoverflow
Solution 1 - PhpOrangepillView Answer on Stackoverflow