Marcel Niehüsener Marcel Niehüsener - 11 months ago 103
PHP Question

imagescale does not work correctly

I'm copying a part of an image using


$img = imagecreatefromjpeg('before.jpg');
$img = imagescale($img, 660, 384);

Before imagescale

After imagescale

Using images with less colors works.

Answer Source

Comments in the PHP documentation propose a solution.

imageScale has got troubles with scaling images... It can output Segmentation Fault when you want to provide custom $mode argument. How to scale image with interpolation in php gd? Use imagecopyresampled() instead of imagescale().