MadnessRed Posted June 19, 2008 Share Posted June 19, 2008 I have a basic image gallery. it works fine and I have made it fit in well with my site. There is only 1 problem, screenshots uploaded at 1280*1024 or even 1024 mess up everything because the table is only 778px wide. I don't know how I ended up with that width but it jsut seemed to fit all the images. Anyway here is what I want. How would I go about a script that said if ($imagewidth >770) { echo '<img src="screenshot.jpg" width="770" />'; } else { echo '<img src="screenshot.jpg" />'; } thanks Link to comment https://forums.phpfreaks.com/topic/110959-solved-if-image-is-wider-than-770px-force-width-to-be-770px-how-would-i-go-abotu-that/ Share on other sites More sharing options...
DarkWater Posted June 19, 2008 Share Posted June 19, 2008 You can get the width with getimagesize(). http://us2.php.net/getimagesize Link to comment https://forums.phpfreaks.com/topic/110959-solved-if-image-is-wider-than-770px-force-width-to-be-770px-how-would-i-go-abotu-that/#findComment-569249 Share on other sites More sharing options...
MadnessRed Posted June 19, 2008 Author Share Posted June 19, 2008 ok, thanks, actually looking at the image gallery that will be impossible to force and also you don't get screenshots with a width less than 770 so i think I will force it to permanently 770 but thanks for the link, it will come in useful elsewhere. Link to comment https://forums.phpfreaks.com/topic/110959-solved-if-image-is-wider-than-770px-force-width-to-be-770px-how-would-i-go-abotu-that/#findComment-569454 Share on other sites More sharing options...
Stephen Posted June 19, 2008 Share Posted June 19, 2008 Heres a good resizing script incase you need it: http://www.phpfreaks.com/forums/index.php/topic,191541.0.html Link to comment https://forums.phpfreaks.com/topic/110959-solved-if-image-is-wider-than-770px-force-width-to-be-770px-how-would-i-go-abotu-that/#findComment-569457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.