Results 1 to 2 of 2

Thread: problem creating a thumbnail

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Location
    Damascus - Syria
    Posts
    16

    Unhappy problem creating a thumbnail

    hi!
    i'm creating a foto album, and want to generate the thumbnails dynamically, so i got the code below which takes the url of an image and creates a small version of it.
    for some reason it is not working, can you please help me finding the error?

    you can try it here:
    http://yusran.com/php/php.exe/getthu...f/friends5.jpg


    here's my complete php code

    PHP Code:
    <?php
    if (isset($_GET['url'])) {
        
    $max_x 150;
        
    $max_y 150;
        return 
    loadjpeg($_GET['url'], $max_x$max_y);
    }


    function 
    loadjpeg($path$max_x$max_y) {
     
    $im = @imagecreatefromjpeg($path);
     if (!
    $im) {
       
    $im  imagecreate(15030);
       
    $bgc imagecolorallocate($im255255255);
       
    $tc  imagecolorallocate($im000);
      
    imagefilledrectangle($im0015030$bgc);
       
    imagestring($im155"Error loading $path"$tc);
     }

     if (
    $max_x != && $max_y != 0) {
       
    $x imagesx($im);
       
    $y imagesy($im);

       if (
    $x $max_x) {
         
    $y = (int)floor($y * ($max_x $x));
         
    $x $max_x;
       }

       if (
    $y $max_y) {
         
    $x = (int)floor($x * ($max_y $y));
         
    $y $max_y;
       }

       if (
    imagesx($im) != $x || imagesy($im) != $y) {
         
    $tmp imagecreate($x$y);
         
    imagecopyresized($tmp$im0000$x$yimagesx($im), imagesy($im));
        
    imagedestroy($im);
         
    $im $tmp;
       }
     }

     return 
    $im;
    }
    ?>
    thank you
    Last edited by ai.unit; Feb 24th, 2003 at 08:30 AM.
    -/-

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    good luck, I couldn't get that to work either. I know you got it right out of the php manual too.

    I think you have to have the most current GD library as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width