Connecting Tech Pros Worldwide Forums | Help | Site Map

image not resizing

Member
 
Join Date: Apr 2009
Posts: 81
#1: Jun 18 '09
hi i m getting the images to display but they are not getting resized here is my code

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. // generating a array with image paths
  4.  
  5. $query_images = "SELECT image_path,image_name FROM userfolders" ;
  6. $result_images = mysql_query($query_images);
  7. confirm_query($result_images);
  8.  
  9. while ($record_images = mysql_fetch_assoc($result_images)) {
  10.           $file = $record_images['image_name'] ;
  11.           $dirname = $record_images['image_path'] ;
  12.  
  13.  
  14. // generating a thumbnail
  15. $thumb_height = 100;
  16. $filename = $dirname."/".$file;
  17. list($width, $height) = getimagesize($filename);
  18.         $ratio = ($height/$width);
  19.         $newheight = $thumb_height;
  20.         $newwidth = ($thumb_height/$ratio);
  21.  
  22.  
  23. ?>
  24. <img src="<?php echo $filename; ?>" width="<?php $newwidth; ?>" height="<?php $thumb_height; ?>" align="top" />
  25. <?php
  26. }
  27. ?>
  28.  
  29. the images get displayed in their original dimensions
  30.  

Newbie
 
Join Date: Jun 2009
Posts: 2
#2: Jun 18 '09

re: image not resizing


Expand|Select|Wrap|Line Numbers
  1. <img src="<?php echo $filename; ?>" width="<?php $newwidth; ?>" height="<?php $thumb_height; ?>" align="top" />
should be

Expand|Select|Wrap|Line Numbers
  1. <img src="<?php echo $filename; ?>" width="<?php echo $newwidth; ?>" height="<?php echo $thumb_height; ?>" align="top" />

u forgot 'echo'
Reply