I am uploading image with uploadify V2.1.4. After uploading image I am trying to create thumbnails of size 60x60 and 80x80 in uploadify.php file. Thumbnails are get created for jpg, png, gif file type. But it is not created when file type is jpeg.
$imgsize = getimagesize($targetFile);
switch(strtolower(substr($targetFile, -3)))
{
case "jpeg":
case "jpg":
$image = imagecreatefromjpeg($targetFile);
break;
case "png":
$image = imagecreatefrompng($targetFile);
break;
case "gif":
$image = imagecreatefromgif($targetFile);
break;
default:
exit;
break;
}
$width = 60; //New width of image
$height=60;
$src_w = $imgsize[0];
$src_h = $imgsize[1];
$picture = imagecreatetruecolor($width, $height);
imagealphablending($picture, false);
imagesavealpha($picture, true);
$bool = imagecopyresampled($picture, $image, 0, 0, 0, 0, $width, $height, $src_w, $src_h);
$image_name='';
if($bool)
{
$image_name=$newf_name;
$parts=explode('.',$newf_name);
$newf_name=$parts[0]."_90X90.".$parts[1];
switch(strtolower(substr($targetFile, -3)))
{
case "jpeg":
case "jpg":
header("Content-Type: image/jpeg");
$bool2 = imagejpeg($picture,$path."thumb/".$newf_name,80);
break;
case "png":
header("Content-Type: image/png");
imagepng($picture,$path."thumb/".$newf_name);
break;
case "gif":
header("Content-Type: image/gif");
imagegif($picture,$path."thumb/".$newf_name);
break;
}
}
The the operation system of the computer where you uploading your images from is absolutely irrelevant.
Instead of posting the code here you have to debug it yourself.
There is very little sense in posting code here. You will get but some wild guesses, mostly irrelevant to your case.
So, you have to make your code to tell you what is going wrong. this is called debugging and being the most important programmer's skill.
First of all you have to be sure, that you will be informed of all errors occurred.
add these lines at hthe top of your code
ini_set('display_errors',1);
error_reporting(E_ALL);
and see if if it says something.
if not - trace your program step by step.
add some exit
's in your code along with printing relevant variables contents to check if they have desired value.