I get the following error when dealing with a png file:
Line -> 39
File -> C:\EasyPHP\www\projeto\config\wide_image\Mapper\PNG.php
Description -> imagepng(): gd-png error: compression level must be 0 through 9.
My script works fine with jpg and gif. I am doing this:
$image = WideImage::load($filein);
$back_color = $image->allocateColor(255, 0, 0);
$resized = $image->resize($max_width, $max_height, 'inside')->resizeCanvas($max_width, $max_height, 'center', 'center', $back_color);
$resized->saveToFile($imagens_dir."/".$fileout,90);
$resized->destroy();
Thanks,
Flavio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Note: don’t be confused if you notice that the compression level parameter of imagepng() has been incorrectly named “quality” in the PHP manual. PNG format has no quality the way JPEG has it (smaller file size ~= uglier image). It’s a lossless image format, so no detail is lost (= the quality remains the same) regardless of the compression level.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I get the following error when dealing with a png file:
Line -> 39
File -> C:\EasyPHP\www\projeto\config\wide_image\Mapper\PNG.php
Description -> imagepng(): gd-png error: compression level must be 0 through 9.
My script works fine with jpg and gif. I am doing this:
$image = WideImage::load($filein);
$back_color = $image->allocateColor(255, 0, 0);
$resized = $image->resize($max_width, $max_height, 'inside')->resizeCanvas($max_width, $max_height, 'center', 'center', $back_color);
$resized->saveToFile($imagens_dir."/".$fileout,90);
$resized->destroy();
Thanks,
Flavio
Ops, I just found my error.
saveToFile($imagens_dir."/".$fileout,90);
I have to test the file (jpg or png) and set compression before saving.
Flavio,
PNG doesn't have quality, only compression.
Quote from WideImage doc: