Jump to content

GD2 (PNG) File makelocalcopyresized (PLEASE HELP)


d22552000

Recommended Posts

I use the following code: (Custom Made so IDK if its proper commands)

 

if($f[1]=='PNG' OR $f[1]=='png'){

$im=ImageCreateFromPNG("uploads/$name") or die('nocreate');
$width=ImageSx($im); $height=ImageSy($im); 

if ($width>$height) {
   $new_w = $n_width; 
   $new_h = floor( $height * ( $new_w / $width ) );
} else {
   $new_h = $n_width;
   $new_w = floor( $width * ( $new_h / $height ) ); 
}

$newimage=imagecreatetruecolor($new_w,$new_h);
imageCopyResized($newimage,$im,0,0,0,0,$new_w,$new_h,$width,$height);
ImagePNG($newimage,$tsrc) or die('nocreate2');

}

 

It doesnt echo nocreate or nocreate2... But no thumbrail is created.

 

Why doesn't it create it, any problems with my code or syntax?

 

I have E_ALL in my error reporting at the first line of the file :D but no errors (or notices) are echoed.

 

BTW, (EDIT) My filetypes returns (IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM), (everything)

1. Yes it enters the statement, it does do an echo I put in it.

 

2. TSRC is just a simple path in the computer.

 

I don't think my commands are right, it wont create the PNG file in the thumbs folder th.

 

It does everything else fine but wont export the file.

 

I did the same thing for a jpg and gif and they both worked.  but the png wont.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.