• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

[PHP]share code cắt ảnh online

Thaoxnet

New Member
Xem demo
Copy code sau và dán vào 1 trang bất kì,tạo thêm thư mục "crop" đặt ngang hàng để lưu ảnh.
<html>
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8"/>
<title>cat anh</title>
</head>
<body>
<?php
function back(){$out='<form method="post"><input type="submit" value="Back"></form>';
return $out;}
echo'<b>Cắt ảnh online</b>';
$do=$_POST['do'];
if(!$do){echo'<form method="post" enctype="multipart/form-data">Tải lên hình ảnh từ máy(.jpg; .png; .gif):<br><input type="file" name="file"><br>Nhập link hình ảnh:<br><input type="text" name="link" value="http://"><br>Vị trí x:<br><input type="text" name="x"><br>Vị trí y:<br><input type="text" name="y"><br>Chiều rộng:<br><input type="text" name="width"><br>Chiều cao:</font><br><input type="text" name="heigh"><input type="hidden" name="do" value="create"><br><input type="submit" value="ok"></form><br>';}
if($do=="create"){$file=$_FILES['file']['name'];
$link=$_POST['link'];
$x=$_POST['x'];
$y=$_POST['y'];
$width=$_POST['width'];
$heigh=$_POST['heigh'];
if($file!=''){$type=$_FILES['file']['type'];
if($type!="image/jpeg"&&$type!="image/png"&&$type!="image/gif"){echo'Chỉ cho phép file gif,jpg,png';
echo back();
exit;}
$file="crop/".$file;
move_uploaded_file($_FILES['file']['tmp_name'],$file);}
if($link&&$link!="http://"){if(!eregi("http://",$link)){echo'Link không hợp lệ.';
echo back();
exit;}
$file=basename($link);
$file=strtok($file,"?");
$length=strlen($file);
$st=$length-3;
$type=strtolower(substr($file,$st,3));
if($type!="png"&&$type!="jpg"&&$type!="gif"){echo'Chỉ cho phép file jpg,gif,png !';
echo back();
exit;}
$file="crop/".$file;
copy($link,$file);}
if($file!=''){if(exif_imagetype($file)==IMAGETYPE_GIF){$src=imagecreatefromgif($file);}
if(exif_imagetype($file)==IMAGETYPE_PNG){$src=imagecreatefrompng($file);}
if(exif_imagetype($file)==IMAGETYPE_JPEG){$src=imagecreatefromjpeg($file);}
$dest=imagecreatetruecolor($width,$heigh);
imagecopy($dest,$src,0,0,$x,$y,$width,$heigh);
$black=imagecolorallocate($dest,0,0,0);
imagecolortransparent($dest,$black);
if(exif_imagetype($file)==IMAGETYPE_GIF){unlink($file);
imagegif($dest,$file);}
if(exif_imagetype($file)==IMAGETYPE_PNG){unlink($file);
imagepng($dest,$file);}
if(exif_imagetype($file)==IMAGETYPE_JPEG){unlink($file);
imagejpeg($dest,$file);}
imagedestroy($dest);
imagedestroy($src);
header("Location: ".$file);}
}
?>
</body>
</html>[nguồn ddviet
 
Bài này đã post lâu rồi
 

Facebook Comments

Similar threads
Thread starter Title Forum Replies Date
T Share code wap chat PHP v1.3 PHP 0
A Share Code PHP Tạo Logo "Angry Birds" By Nguyên Ary Mã nguồn wap 1
Yeukodamnoi [you] ơi, có Code php nhắn tin free không, Share mình cái Mã nguồn wap 15
H [Share] code php tạo ebook .jar Mã nguồn wap 0
Admin Share code php random game hot Mã nguồn wap 0
M admin share cho e code say.php của johncms Johncms 0
S Share code bot wapka giống php All Shared Scripts 7
Admin Share source code PHP nghe nhạc nhacf.com (tăng traffic cho Web Google Search) Mã nguồn web 0
T Share code wap game php full data by svcantho.biz fix link All Shared Scripts 7
Admin Share code phòng chát php cực vip fix link Mã nguồn wap 0
Admin Share code (PHP) ShoutCloud - Code chatbox ajax khá đẹp Mã nguồn web 0
Admin Share PHP Melody 1.6.7 - Code nghe nhạc, xem phim giống NCT và Zing MP3 Mã nguồn web 1
tubotocdo [SHARE] Code WAP GAME MOBILE PHP All Shared Scripts 2
T Share (PHP ) ShoutCloud - Code chatbox ajax khá đẹp Mã nguồn web 2
NhokLove Share code wap hình nền php cool Mã nguồn web 1
Admin Share cuốn ebook "Tổng hợp PHP (TEST)" bản test cho anh em Sách, truyện, tài liệu 3
D Share công cụ tùy chỉ đã sửa biến cho PHP PHP 0
L [PHP] Share Viral Lottery Facebook App V 1 .2 PHP 2
N Share - php search engine - công cụtìm kiếm nội dung bằng php Phpbb3x 4
Admin Share vBulletin.Suite.v4.2.0.PHP.NULL-FS Vbb released 0
Admin [Share] php filelist hình nền flash Mã nguồn wap 1
Admin Giữ nguyên giá trị khi gửi form php - keep form values after post php PHP 0
Admin Giữ giá trị trong menu đổ xuống trong form php - Php keep dropdown value after form submit PHP 0
nutevnn Help Nhờ hướng dẫn fix html trong PHP PHP 0
ducnvna Kênh HỌc lập trình php miễn phí cho anh em mới bắt đầu PHP 0
Admin Hướng dẫn cài IIS, PHP, MySQL trên Windows Server 2012 R2 chi tiết 2020 VPS & Dedicated Server 0
Admin Yilmaz - Hide [code,php,html] content from guests (vb5.6.x) Add-ons 0
Vtkun Xin giải mã code php Thảo luận chung 0
Admin Hướng dẫn kích hoạt GMP trong php Windows Server 2012 - How to enable php GMP functions VPS & Dedicated Server 0
Admin Hướng dẫn lấy địa chỉ IP khách truy cập bằng PHP mới nhất PHP 0
Admin Share code php check rank Việt Nam và thế giới từ Alexa PHP 0
Admin Hướng dẫn phân trang bảng PHP sử dụng MySQLi PHP 0
blog4me Crack KSWEB: server + PHP + MySQL v3.961 [Pro] Crack, hack, mod, ghép game, ứng dụng 0
T Học ngôn ngữ php nâng cao phần 5 Tin tức CNTT 0
filiallion Hướng dẫn Từng bước học lập trình PHP cơ bản qua dự án website giới thiệu sản phẩm PHP 2
T Share Code PHP HảiCMS giao diện BĐS Mã nguồn web 0
G Share Tạo trang upload tập tin với PHP PHP 2
C Hỏi Cách tạo hosting trên winserver 2008R2 chạy code php và worpress Hỏi đáp về domain & hosting 0
thanhchiit Share Code PHP Hiển Thị Ping MS cho Web/Wap Mã nguồn wap 5
Admin Hướng dẫn cấu hình Nginx và php-fpm để dùng socket trên CentOS 6 đơn giản VPS & Dedicated Server 0
K Share Code PHP hạn chế tấn công DDOS PHP 4
Admin Hướng dẫn ẩn phiên bản php trên Nginx và Apache VPS & Dedicated Server 0
Admin Hướng dẫn cài php 5.6 và các phiên bản php trên CentOS 6, CentOS 7 đơn giản VPS & Dedicated Server 0
Admin Hướng dẫn fix lỗi /includes/vfchh/php/vfc_hide_core.php on line 163 mod vFCoders - Hide Hack v4 Vbb tutorial 0
D Xin code php Mã nguồn web 0
C Share TUYỂN DỤNG nhân viên lập trình Php (Nhận học việc, sinh viên mới ra trường) Kiến thức lập trình 0
C TUYỂN DỤNG nhân viên lập trình Php (Nhận học việc, sinh viên mới ra trường) Tin tức, sự kiện thường ngày 0
blog4me Share Code web đọc truyện online PHP Mã nguồn web 22
S Bạn đã tìm hiểu qua học php chưa Máy tính 1
S Share Cách viết khi học php cơ bản Máy tính 1

Similar threads

New posts New threads New resources

Back
Top