Jump to content

[SOLVED] Is this hard to fix?


acctman

Recommended Posts

I pretty sure this is not hard to fix for anyone who knows php well. I'm able to read though the coding and see areas that maybe the reason for the code now working but so far no php programmer i've come across has been able to fix it. I've added comments explaining what each code should do. It should take 30secs or less for an experience programmer to spot the problems. And, no I'm not receiving any errors so I can't google or look up a fix for it. Its only 9 lines of codes so its not a lot.

 

thanks in advance

 

//$_FILES["Filedata"]["tmp_name"]  the 'tmp_name' is the PHPSESSID so the name will always be unique
// there is coding above this that works fine.

// Get File Extension 
$ext=$_FILES["Filedata"]["type"];

// Convert Image to .jpg if the extension is not .jpg 
if($ext == "jpg" || $ext == "jpeg" || $ext == "pjpeg") { 
          $image = imagecreatefromjpeg($picture); 
            } elseif($ext == "gif") { 
          $image = imagecreatefromgif($picture); 
} 

//Save converted image 
//Now i need to save the filename back to the PHPSESSid which is pretty much what ever $_FILES["Filedata"]["tmp_name"] is but with the .jpg extension.

header ("Content-type : image/jpg"); 
ImageJpeg($image); 
ImageJpeg($image, "image.jpg");  ///////////// this needs to be $_FILES["Filedata"]["tmp_name"] . jpg 

Link to comment
https://forums.phpfreaks.com/topic/103670-solved-is-this-hard-to-fix/
Share on other sites

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.