Image upload and resizing
Posted: Thu Oct 13, 2005 8:37 am
Can someone please help with this code ,I can't figure what's wrong?
Code: Select all
//Upload default slike//
if (!($HTTP_POST_FILES['slikad']["type"]== "image/gif"
||
$HTTP_POST_FILES['slikad']["type"] == "image/jpg"
||
$HTTP_POST_FILES['slikad']["type"] == "image/jpeg"
||
$HTTP_POST_FILES['slikad']["type"] == "image/pjpeg"
))
//image out of the form
$uploaddir = '/home/radio057/public_html/images/vijesti/default/';
$image =$HTTP_POST_FILES['slikad'];
$image["slikad"] =parse_file_name($image["slikad"]);
$image_name =substr($image["slikad"],0,strpos($image["slikad"],"."));
$image_ext =substr($image["slikad"],strpos($image["slikad"],"."));
$fi = "";
while(file_exists($uploaddir.$image_name.$fi.$image_ext)) $fi++;
$image_name =$image_name.$fi.$image_ext;
$image_path =$uploaddir.$image_name;
$thumb_path =$uploaddir."thumbs/".$image_name;
move_uploaded_file($image["tmp_name"],$image_path);
copy($image_path, $thumb_path);
resize_image($thumb_path, '100','100');
resize_image($image_path, '300','300');
if (file_exists($image_path)){
$images[] = $image_name;
}
}//END if(!$ERROR)