WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-22-2004, 05:40 PM
wmabear54 wmabear54 is offline
WebProWorld Member
 

Join Date: Nov 2003
Location: Bedford, Va.
Posts: 72
wmabear54 RepRank 0
Default Thumbnails and PHP

Hi
Maybe I can get a hint from someone on this.

What I have in mind is to create the thumbnail from gif or jpeg images that I have in directories. All the gif and jpeg images are of different sizes and shapes, that is not a problem as I can run a few tests and then assign a percentage to either the width or height variable.

The problem is what to do with the rest of the space. What I mean by that is if say the original size was 500pix x 100pix and I want the thumb to be no more than 100pix, I can with no problem do that. But the thumb is only 20pix high now, there is a lot of empty space below it now.

What I want to do is build a container that is 100pix by 100pix and put the thumb into it, centered is the ideal, but left and top isn't a problem.

I think it has to do with transparent colors so that the image shows through.

Thanks in advance
Mike
Reply With Quote
  #2 (permalink)  
Old 10-22-2004, 05:59 PM
morpheus.100 morpheus.100 is offline
WebProWorld Pro
 

Join Date: May 2004
Location: USA
Posts: 101
morpheus.100 RepRank 0
Default

Check out php's GD image functions and bulding images.
Reply With Quote
  #3 (permalink)  
Old 10-22-2004, 06:00 PM
steve0 steve0 is offline
WebProWorld Pro
 

Join Date: May 2004
Location: Austin, TX
Posts: 199
steve0 RepRank 0
Default

No quite sure what you mean by empty space.. but
depending on how you generate your thumbnail..

here is some quasi-code that may help..using php

<?
$ImageInfo = getimagesize("imagedir/yourthumbnail");
$image_width=$ImageInfo[0];
$image_height=$ImageInfo[1];
?>
<table cellpadding=2>
<tr>
<td width="<?= $image_width?>" height="<?= $image_height ?>" valign="center" align="center">
[img]yourthumbnail[/img]" height="<?= $image_height ?>" alt="some optimized text">
</td>
</tr>
</table>
__________________
Hardcore Programming Solutions and Coffee Drinker
Reply With Quote
  #4 (permalink)  
Old 10-22-2004, 06:19 PM
wmabear54 wmabear54 is offline
WebProWorld Member
 

Join Date: Nov 2003
Location: Bedford, Va.
Posts: 72
wmabear54 RepRank 0
Default

Hi
What you are saying is to just through it into a borderless table why didn't I think of that. What I had been trying to do was to createimage(100, 100);as the canvas and then put the resized image on the canvas. I had already done getimagesize for the original size to make the calulations 100/$width or 100/$height to obtain a percentage for the $newwidth or $newheight. I will play with that and see if that is all I need.
Thanks Mike
Reply With Quote
  #5 (permalink)  
Old 10-23-2004, 05:43 PM
morpheus.100 morpheus.100 is offline
WebProWorld Pro
 

Join Date: May 2004
Location: USA
Posts: 101
morpheus.100 RepRank 0
Default

Use

imagesx
imagesy

Many times faster
Reply With Quote
  #6 (permalink)  
Old 10-24-2004, 03:24 AM
wmabear54 wmabear54 is offline
WebProWorld Member
 

Join Date: Nov 2003
Location: Bedford, Va.
Posts: 72
wmabear54 RepRank 0
Default

Hi morpheus.100

Yea sounds good I am finding a lots of good info in GD, checking into imagemaqick too (bad speller). Don't want to re-invent the wheel but it does a lot of good to try sometimes. Getting a little closer every day.

Mike
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: php, thumbnails



Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



Search Engine Friendly URLs by vBSEO 3.0.0