mjgdunne Posted May 1, 2008 Share Posted May 1, 2008 Hi all, I am having a slight problem, i want to display images which i am taking from a directory i have the images displaying but they are huge. I was wondering if there is any way of resizing the image. Here is my code to display the image. echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='cars/".$row['image']."'/>"; echo "</td></tr>"; Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/103717-solved-image-size/ Share on other sites More sharing options...
cstevio Posted May 1, 2008 Share Posted May 1, 2008 You try use this script, it's quite neat. http://www.verot.net/php_class_upload.htm Quote Link to comment https://forums.phpfreaks.com/topic/103717-solved-image-size/#findComment-531030 Share on other sites More sharing options...
mjgdunne Posted May 1, 2008 Author Share Posted May 1, 2008 Hi thanks, im new to php and it seems complicated to me, is there anyway of just adjusting the image size when echoing it out? Quote Link to comment https://forums.phpfreaks.com/topic/103717-solved-image-size/#findComment-531049 Share on other sites More sharing options...
Michan Posted May 1, 2008 Share Posted May 1, 2008 You could simply use width and height in the <img> tag, if the size reduction is for the user interface rather than the bandwidth. Quote Link to comment https://forums.phpfreaks.com/topic/103717-solved-image-size/#findComment-531051 Share on other sites More sharing options...
mjgdunne Posted May 1, 2008 Author Share Posted May 1, 2008 Hi yes this seems the easier option, but iv tried adding height and width into this code: echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='cars/".$row['image']."'/>"; echo "</td></tr>"; Except im getting the following error. Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in C:\xampp\htdocs\viewimg.php on line 69 Quote Link to comment https://forums.phpfreaks.com/topic/103717-solved-image-size/#findComment-531057 Share on other sites More sharing options...
Michan Posted May 1, 2008 Share Posted May 1, 2008 echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='cars/".$row['image']."' width='100' height='100'/>"; echo "</td></tr>"; That's the easy way. If you're still having problems, can you post whatever is on that line? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/103717-solved-image-size/#findComment-531064 Share on other sites More sharing options...
mjgdunne Posted May 1, 2008 Author Share Posted May 1, 2008 Great thanks, i had put it inside the quotation marks. Quote Link to comment https://forums.phpfreaks.com/topic/103717-solved-image-size/#findComment-531066 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.