Jump to content


Problem with Auto thumbnail image creation

  • Please log in to reply
No replies to this topic

#1 sraul

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 October 2006 - 02:52 PM

I am trying to create thumnail image using following function. This function is giving me correct output on my local machine

(windows OS). I have PHP4 and gd2 library installed on my local machine. 

The server machine is having PHP5 and gd2 library installed.

The problem i am facing is when the same code is executed  on the server (windows OS) the thumnail image for image size

greater than 65KB is getting created but for images less than 65KB, gives black image box. So please tell me what is the

exact problem?

function createthumb($name,$filename,$new_w,$new_h)


$count = count($system1) ;

$system[1] = $system1[$count-1];

//$name = strtolower($name1);

if (preg_match("/jpg|jpeg|JPG|JPEG/",$system[1])){
  echo "<br>";
                // echo "hallo==" . $name ;
        echo "<br>";

  echo "src_img inside if  == "  .$src_img ;
  echo "<br>";
if (preg_match("/png|PNG/",$system[1])){$src_img=imagecreatefrompng($name);}



$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h) or die("not working");
$trial = imagecopyresized($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);

echo "dst_img == " . $dst_img ;
echo "<br>";
echo "trial == " . $src_img ;
echo "<br>";

if (preg_match("/png/",$system[1]))
} else {

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users