Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by paster! ( 14 years ago )
<?echo "<div align='center'><h4> Növbə şəkil seçməkdədir!</h4>
 <form method='post' acti enctype='multipart/form-data'>
 Şəkil seç : <input type='file' name='movie_image'>
 <input type='submit' name='image_submit' value='Əlavə et'>
 </form></div>";

if($_POST['image_submit']){
if(!empty($_FILES['movie_image']['name']))
{
// image credentials
$c = 0; $image_name = stripslashes($_FILES['movie_image']['name']);
// *** //
$image_tmp  = $_FILES['movie_image']['tmp_name']; $image_type = $_FILES['movie_image']['type'];
// *** //
$accept_f = array('jpeg','png');
// *** //
$image_size = $_FILES['movie_image']['size']/1024; 
// *** //
if(substr($image_type,6) == $accept_f[0]) {$image_name = explode(".".$accept_f[0],$image_name);}
else{$image_name = explode(".".$accept_f[1],$image_name);}
// *** //
$get_size = getimagesize($image_tmp); $width = $get_size[0]; // 200px
// *** //
$height = $get_size[1]; $image_path = '../../movie_img/'.$image_name[0].'-130x195.'.substr($image_type,6);

      // end 
// 80x15
if(in_array(substr($image_type,6),$accept_f)){

if($width <= 200 && $height <= 300){

if($width < $height) { $status = 1;}

switch ($status){case 1:$newwidth = 130;$rat = $newwidth / $width;$newheight = $height - 105; break;}

if($image_type == "image/jpeg") { $from = imagecreatefromjpeg($image_tmp);}

elseif($image_type == "image/png") { $from = imagecreatefrompng($image_tmp);}

$thumb = imagecreatetruecolor($newwidth, $newheight); 
$resi = imagecopyresized($thumb, $from, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$ijpg = imagejpeg($thumb, $image_path);
if($thumb and $resi and $ijpg){echo "[removed]alert&#40;'oldu'&#41;;[removed]";}else{echo "[removed]alert&#40;'olmadi'&#41;;[removed]";}


}else{echo "Ölçü düz deyil!";}
}else{echo "<p class='er'>Format düz deyil!</p>";}
}else{echo "d";}
}else{echo "d";}

 

Revise this Paste

Your Name: Code Language: