Connecting Tech Pros Worldwide Help | Site Map

image not resizing

  #1  
Old June 18th, 2009, 12:30 AM
Member
 
Join Date: Apr 2009
Posts: 81
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.  
  #2  
Old June 18th, 2009, 11:23 AM
Newbie
 
Join Date: Jun 2009
Posts: 2

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'

Last edited by Markus; June 18th, 2009 at 12:56 PM. Reason: Added [code] tags.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python Substitute for PHP GD, Resizing an image on the client side brahmaforces answers 8 August 21st, 2008 12:05 PM
Image Resizing with ASP vunet.us@gmail.com answers 2 January 23rd, 2007 03:05 PM
Image in browser not resizing! davebarkshire answers 0 November 19th, 2005 01:05 AM
Disable automatic image resize Weng kin answers 6 July 20th, 2005 10:35 AM