graham23s Posted November 15, 2007 Share Posted November 15, 2007 Hi Guys, what im trying to do is get random inages from mysql and display them in like a "random profile" box, but i was trying to keep them all roughly the same size, so basically grab them from mysql and: <img src="images/image1.jp2" height="$height" width="$width"> so basically it just displays them in the correct ration WITHOUT saving them is this possible at all? thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/77508-resizing-images-on-the-fly/ Share on other sites More sharing options...
s0c0 Posted November 15, 2007 Share Posted November 15, 2007 I do this on my server, but since its my server I just use image magick's convert command. My code looks like this: function imgResize($img) { exec('convert -size 125x125 '.$img.' -resize 125x125 '.$img); return true; } Where image is the full path to the file. Link to comment https://forums.phpfreaks.com/topic/77508-resizing-images-on-the-fly/#findComment-392345 Share on other sites More sharing options...
graham23s Posted November 15, 2007 Author Share Posted November 15, 2007 Hi Mate, that worked a treat, is magick better/worse than GD can you also save resized images with it? cheers Graham Link to comment https://forums.phpfreaks.com/topic/77508-resizing-images-on-the-fly/#findComment-392374 Share on other sites More sharing options...
s0c0 Posted November 15, 2007 Share Posted November 15, 2007 I wouldn't be the right person to ask if it is better or worse, but its obviously easier and there aren't really any downsides. The portion after the -resize argument is where you are telling the command to save the file. In the example I gave, I am just over writing the existing file. Link to comment https://forums.phpfreaks.com/topic/77508-resizing-images-on-the-fly/#findComment-392431 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.