Просмотр файла users/cover.php

Размер файла: 1.75Kb
<?php
require '../inc/func.php';
bk_head('Cover Photo');
require '../inc/head.php';
include_once '../gallery/fun.php';



if (!$user) {
header ('location: /index.php');
exit;
}

$uid = num($_GET['uid']);

if(empty($uid) || $uid != $userid){
header('location: cover.php?uid='.$userid.'');
}


echo '<div class="list1"><div class="tt">Upload Cover Photo</div><div class="shadow">';

if(isset($_POST['save']) && $_FILES['photo']['size'] > 0) {	
$type = $_FILES['photo']['type'];
if ($type =='image/jpeg' || $type =='image/jpg' || $type =='image/png') {

$create = imagecreatefromstring(file_get_contents($_FILES['photo']['tmp_name']));
$imgx = imagesx($create);
$imgy = imagesy($create);

if($imgx > $imgy){

   $img=imagecreatetruecolor(590,150);

   imagecopyresampled($img,$create,0,0,0,0,590,150,$imgx,$imgy);
$img = watermark($img);
         $dir = '../gallery/cover/'.$userid.'.jpg';
      imagejpeg($img,$dir,95); 
   	  imagedestroy($img);

		err ('Uploaded Cover Photo!<br /><a href="/u/'.$userid.'">&larr; Home</a>');
	}
}	else {
		err ('ERROR!');
	}
}

?>
		

<form method="post" enctype="multipart/form-data"> Chỉ cho phép ảnh định dạng JPG, JPEG, PNG, GIF <br />
Chọn ảnh:<br /><input type="file" name="photo" accept="image/jpeg,image/png,image/gif" /><br />
<input type="submit" name="save" value="OK">
</form>
<div class="left_bot"><font color="red">Lưu Ý:</font><br />
1. Dung lượng tối đa là 300kb..<br />
2. Chiều ngang ảnh phải lớn hơn chiều cao ảnh..<br />
3. Tên tập tin gồm tiếng việt không dấu (a-Z, 0-9, _, -)..<br />
4. Hình ảnh sẽ bị xóa nếu nó là ảnh gây phản cảm, sex,...<br /></div></div></div>

<?php

bk_foot();

?>