imagescale does not work correctly

gd, image, php

Solution

Comments in the PHP documentation propose a solution.

http://php.net/manual/en/function.imagescale.php

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().

Problem

I'm copying a part of an image using `imagescale`: ``` $img = imagecreatefromjpeg('before.jpg'); $img = imagescale($img, 660, 384); ``` Before: After: Using images with less colors works.

Original source