here is the code part of my thumbnail action page.
Im not sure why its calling imagecreatefromjpeg, because it shouldnt be going into that if statement.
Here
<?
session_start();
$username = $_SESSION['username'];
$imageName = $_SESSION['name'];
if ($_SESSION['logged']!==true) {
header('location:loginfailed.php');
}
else {
//Name you want to save your file as
$save = 'th_'.$_SESSION['name'];
$thumb = "th_".$_SESSION['name'];
$file = $_SESSION['name'];
list($width, $height) = getimagesize($file) ;
$width2 = 160 / $width;
$height2 = $height * $width2;
$modwidth = 160;
$modheight = $height2;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
// Here we are saving the .jpg, you can make this gif or png if you want
//the file name is set above, and the quality is set to 100%
if ($_SESSION['extension'] == "jpeg" || $_SESSION['extension'] == "jpg")
{
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100);
}
if ($_SESSION['extension'] == "gif")
{
$image = imagecreatefromgif($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100);
}
if ($_SESSION['extesion'] == "png")
{
$image = imagecreatefrompng($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagepng($tn, $save, 100);
}