I wrote a small function like the following to create my won thumbnails.

function make_tumb_nail($url){

  $size=GetImageSize("image/$url");
  $ht=$size[1];
  $wd=$size[0];

  if($ht>$wd){
  $h=$ht;
  for($i=1.01;;){
   if($h<121){
    break;
   }
   $h=$ht/$i;
   $w=$wd/$i;
   $i=$i+0.01;
  }
  } else {
  $w=$wd;
  for($i=1.01;;){
   if($w<91){
    break;
   }
   $h=$ht/$i;
   $w=$wd/$i;
   $i=$i+0.01;
  }
  }
  $wd=floor(round($w));
  $ht=floor(round($h));
  $returnstring="width=$wd height=$ht border=0";
  return $returnstring;
}

This function returns the thumbnail width and height as string and use 
it along with the original string.

<img src="image/<?php $url ?>"  <? php make_thumb_nail($url) ?>>

Hope this helps.


Richard wrote:

> Greetings.
> 
>     Is there any quick way to generate thumbnails of existing pictures in a
> directory? It would seem quite worthless to create 120x120 images of ones
> that already exist, and upload duplicates.. Therefore, dynamic thumbnails
> would be perfect. Any solutions?
> 
>     PHP 4.0+ thanks.
> 
> - Richard
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to