Jump to content

GD2 (PNG) File makelocalcopyresized (PLEASE HELP)


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.