473,467 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

image not resizing

116 New Member
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.  
Jun 17 '09 #1
1 1361
yangyucn
2 New Member
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'
Jun 18 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jim | last post by:
I've heard that resizing images through PHP (either GD2 or ImageMagick) is a processor intensive exercise. I'm setting up a site where users will be uploading up to 10 images along with the details...
6
by: bissatch | last post by:
Hi, I have a collection of images stored in a DB. They are there for the purpose of a news system. When the user views the homepage it will diplay cropped versions of the news where the user...
3
by: Zahid Khan | last post by:
I need little help in my situation. I am reading a graphic file (jpg) from disk and then resizing it and save resized image. What happens, it gets blured, I want to retain same quality so that...
10
by: David W. Simmonds | last post by:
I have a DataList control that has an Image control in the ItemTemplate. I would like to resize the image that goes into that control. I have a series of jpg files that are full size, full...
8
by: berkshire | last post by:
Hi, Anyone know of a script out there that can resize images and not sacrifice image quality? I've been using phpthumb (http://phpthumb.sourceforge.net/) but when compared to an image resized...
9
by: tshad | last post by:
Is there a way to display images (imageButtons or linkbuttons for instance) as a max size (200px by 50px) and not have it stretch the image? What I want to be able to do is limit the real estate...
9
by: kombu67 | last post by:
I'm reading a series of images from a MS SQL table and saving them to directory. These are staff ID pictures from our security card app. Once I've extracted the ID photo from the security app to...
10
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for...
11
by: shapper | last post by:
Hello, I am displaying an image on a few pages. The image size is 50 px height and 50 px width. In some pages I need the image to be 30x30 px in others 40x40 px and in others 50x50px. Can I...
14
anfetienne
by: anfetienne | last post by:
hi.....i have this script (below #1) that is linked to another php file SimpleImage.php (#2) im trying to get it to work on my uploaded images but it keeps coming up errors.....i haven't altered...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.