Giddy Rob Posted April 20, 2010 Share Posted April 20, 2010 Hi, I am a little stuck as I need to resize an image then get the width and height for a record in my database. What I am basically trying to do is have a set of three constraints for the size or a custom size the user can set. For example if one option says"400 height || 400 width" then the width or the height will be set to a maximum of 400px, depending on the which is the largest (keeping aspect ratio). The custom just allows them to set the width and height themselves. It was previously done with this command below, but the system has now moved servers so it doesn't work anymore as I don't think I have permission to use the system call. if ($_POST['picsize'] == 'S') {$_POST['maxwidth']=100;$_POST['maxheight']=100;} if ($_POST['picsize'] == 'M') {$_POST['maxwidth']=250;$_POST['maxheight']=250;} if ($_POST['picsize'] == 'L') {$_POST['maxwidth']=400;$_POST['maxheight']=400;} if ($_POST['maxwidth'] > 0 && $_POST['maxheight'] > 0) { system("/usr/local/bin/convert -quality 80 -thumbnail {$_POST['maxwidth']}x{$_POST['maxheight']}\\> \"{$_FILES['ins_image']['tmp_name']}\" \"../news_images/{$_FILES['ins_image']['name']}\""); } I would like to do this with imagemagick if possible. Any help would be great Cheers in advance Rob Shillito Link to comment https://forums.phpfreaks.com/topic/199154-resizing-an-image-using-imagemagick/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.