Jump to content

Help with imagemagick


garethhall

Recommended Posts

Hello I have got a image up-loader and when it's done I want it the generate a thumbnail. Now I have that part working. But the image size is just to big for a thumbnail. Perhaps my code could be cleaner and do it all in one pass? I also believe that the file size is to big because I am not resampling the thumbnail? Any help would be great. but when I do a resample it changes my image dimensions? Can I tell it not to. One more thing I did add a resample function before the resize but I kept on getting a 500 error? But when I shift it to after resize I don't get the error?

 

<?php
// Maximum image width
$max_width = "128";
// Maximum image height
$max_height = "128";
//$thumbnailPath = $basePath . 'smartP/thumb/' . $fileName;
$thumbnailPath = '../smartP/thumb/' . $fileName;

// imagemagic functions
exec("convert $originalPath -resize {$max_width}x{$max_height}\> $thumbnailPath");// Resize to tumbnail dimensions
exec("convert -density 72 $thumbnailPath $thumbnailPath");// change to 72 dpi
exec("convert -quality 60% $thumbnailPath $thumbnailPath");// change quality.
?>

Link to comment
https://forums.phpfreaks.com/topic/176600-help-with-imagemagick/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.