i've put in this thres before and didnt get much hlp.
i wanna enable users of the site to upload a picture into a file (like in hi5 or yahoo messenger) and have it displayed as a thumbnail which would have a link to the original sized picture.

11 Years
Discussion Span
Last Post by zippee

I use the similar on my store2go site. You can do it in two ways:
1. Upload image and instantly create a thumbnail. See code:

// if jpg use 
// else if gif use
// and for png use

// create the scaled instance for thumbnail in GIF
// write the damned thing to disk 

2. Upload image and resize to the acceptable resolution (say 800x600 max). When displaying the thumb and link, simply resize the resized image using code below:

$size = GetImageSize($image);
$width = round($size[0]);
$height = round($size[1]);
$percentage = 1;
// set target thumbnail size
$targetw = 100;
$targeth = 75;

// reduce image to target dimensions
if ($width > $height) { 
  if ($width > $targetw)  $percentage = ($targetw / $width); 
else { 
  if ($height > $targeth) $percentage = ($targeth / $height); 
$width = round($width * $percentage); 
$height = round($height * $percentage); 
 echo '<a href="'.$image.'"><img src="'.$image.'" border="0" alt="" width="'.$width.'" height="'.$height.'"></a>';
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.