The basic process of this php code is to take the submitted file, convert it to a small JPG thumbnail and put it into one directory and save the original file into another, but it seems that when using PNG images it doesn't quite work, any ideas?
Code: if((($_FILES['file']['type'] == "image/gif")
|| ($_FILES['file']['type'] == "image/jpeg")
|| ($FILES['file']['type'] == "image/pjpeg"))
&& ($_FILES['file']['size'] < 2000000000))
{
if($_FILES['file']['error'] > 0)
{
echo '<script language="javascript" type="text/javascript">window.top.window.upload_error(' . $_FILES['file']['error'] . ');</script>';
}
else
{
$fileName = $_FILES['file']['name'];
$f_ext = "." . strtolower(substr(strrchr($fileName, '.'), 1));
$time = time();
$f_noext = $time.substr(microtime(),2,3);
$f_name = $time.substr(microtime(),2,3) . $f_ext;
if(file_exists("img/" . $f_name))
{
echo $_FILES['file']['name'] . " already exists.";
}
else
{
move_uploaded_file($_FILES['file']['tmp_name'], "img/" . $f_name);
$image_path = "img/" . $f_name;
$fsize = getimagesize($image_path);
$max_d = ($orig_p==0)? 250 : 125;
$img = null;
$ext = strtolower(end(explode('.', $image_path)));
if($ext == 'jpg' || $exit == 'jpeg')
{
$img = @imagecreatefromjpeg($image_path);
}
else if($ext == 'png')
{
$img = @imagecreatefrompng($image_path);
}
else if ($ext == 'gif')
{
$img = @imagecreatefrompng($image_path);
}
if($img)
{
$w = imagesx($img);
$h = imagesy($img);
$width = imagesx($img);
$height = imagesy($img);
$scale = min($max_d/$width, $max_d/$height);
if($scale < 1){
$new_width = floor($scale *$width);
$new_height = floor($scale*$height);
$tmp_img = imagecreatetruecolor($new_width, $new_height);
imagecopyresized($tmp_img, $img, 0,0,0,0,$new_width,$new_height,$width,$height);
imagedestroy($img);
$img = $tmp_img;
ImageJPEG($img, 'thumb/' . $f_noext . 't.jpg',60);
imagedestroy($tmp_img);
echo '<script language="javascript" type="text/javascript">window.top.window.stopUpload();</script>';
}
}
}
}
}
DB2 for z/OS, LUW, iSeries
Hello,
Ball movement
I want to move a ball from one point to another and it should hit a group of balls at the other end and scatter them.Could You kindly explain with sample code?
Need a fuction to count entries in a field
HiI need a fuction to count how many times a email address is entered in to a field.I making a for wordpress that counts how many timesa user has made comments.Thanks
contact form - output to page and email
I have the following in my controller:$message['name'] = htmlentities(strip_tags(trim($_POST['name']))); $message['email'] = htmlentities(strip_tags(trim($_POST['email'])));$to =
IP question
ive got 2 ip addresses both global from same user how would i detect if they are local to each other
Array becomes unset by itself?
Hi,I have a bit of experience with PHP but not extensive. It seems I cannot store any items to the array $details. The class:class Newsletter {public $details = array();function Newsletter($id)
need Array help
This is what I have to do. $teamname[1] = "Red Sox" $teamname[2] = "Giants" $teamname[3] = "White Sox" $teamname[4] = "Cubs" $teamname[5] =
Can you help please? Php file
I have to write this php file to allow users to register their nicknames on nickservFor an IRC server, however it worked fine for a couple of years, I then upgraded from Php4 to Php5 and suddenly
Error when call dll from oracle
Hi all, please help me!
Save cookie to DB
I'm working on a pixel tracking script for an incentive website and I need to use an ASP script to save the cookie from the user to a MySQL DB via a 1 pixel image, such as follows.<img