Web Design Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignWeb Design Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 29th, 2005, 08:09 PM
MasterMinds MasterMinds is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2004
Posts: 556 MasterMinds Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 2 Days 12 h 9 sec
Reputation Power: 0
Using img tag to resize image in desired format - avoid generating thumbnails

I have a site where I need to generate a smaller version of an image file. WHat I need is for the largest of the two sizes to be = 83 pixels.

If I take this <img src="" width="83" /> it works, except I cannot guarentee the images largest size is the width, it could be the height. It auto generates the other one porportionally, so that parts ok.

I do not want to use a script that creates a thumbnail copy unless I MUST, because I don't want to use extra space until I move up to a dedicated server.

Is there a way I can take the largest porportion of a given image, and then generate the proper code?

This can be in javascript or php for this site. In theory something like

If width <= height

...generate "<img src="$image_url" height="83" />

else if
...generate "<img src="$image_url" width="83" />

Just not sure how to grab those values.

An example would be great, as my programmer wants to use a generation but if I can hand him a solution saves us both time.

Thanks so much!

Reply With Quote
  #2  
Old January 30th, 2005, 12:53 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,461 jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 15 h 14 m
Reputation Power: 825
FYI: If you display a full size image with smaller dimensions, the browser still downloads the full size image. This means the bandwidth usage and load time of each image would be the same for the "thumbnail" as the original size image.
Comments on this post
MasterMinds agrees!
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
  #3  
Old February 5th, 2005, 05:48 AM
relaxzoolander's Avatar
relaxzoolander relaxzoolander is offline
web designer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: columbus, ohio
Posts: 118 relaxzoolander User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 36 m 32 sec
Reputation Power: 5
Send a message via ICQ to relaxzoolander Send a message via AIM to relaxzoolander Send a message via Yahoo to relaxzoolander
<img src="some-image.jpg" id="myimage">

document.getElementById('myimage').width;
document.getElementById('myimage').height;

Comments on this post
MasterMinds agrees!

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignWeb Design Help > Using img tag to resize image in desired format - avoid generating thumbnails


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT