Kiến thức là vô biên, vì vậy hãy chia sẻ nó. Trên đây là một số công cụ và source mình sưu tầm được. Mong là nó sẽ hữu ích đối với bạn !
Code Google
Hiển thị các bài đăng có nhãn Function source vihan. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Function source vihan. Hiển thị tất cả bài đăng
Thứ Năm, 7 tháng 11, 2013
Thứ Hai, 19 tháng 8, 2013
Function thumbs 1.1
function thumbs($outpath,$inpath,$outimg,$inimg,$insize) {
if(@copy("".$outpath."/".$outimg."", "".$inpath."/".$inimg."")) {
$f_name = end(explode(".", $inimg));
$f_extension = strtolower($f_name);
if ($f_extension == "jpg" && extension_loaded("gd")) {
$src_img= ImageCreateFromJpeg("".$inpath."/".$inimg."");
$src_width= ImagesX($src_img);
$src_height= ImagesY($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=ImageCreateTrueColor($dest_width, $dest_height);
ImageCopyResampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
ImageJpeg($dest_img, "".$inpath."/".$inimg."", 100);
ImageDestroy($dest_img);
}
if ($f_extension == "png" && extension_loaded("gd")) {
$src_img= imagecreatefrompng("".$inpath."/".$inimg."");
$src_width= imagesx($src_img);
$src_height= imagesy($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=imagecreatetruecolor($dest_width, $dest_height);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagepng($dest_img, "".$inpath."/".$inimg."");
imagedestroy($dest_img);
}
if ($f_extension == "gif" && extension_loaded("gd")) {
$src_img= imagecreatefromgif("".$inpath."/".$inimg."");
$src_width= imagesx($src_img);
$src_height= imagesy($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=imagecreatetruecolor($dest_width, $dest_height);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagegif($dest_img, "".$inpath."/".$inimg."", 100);
imagedestroy($dest_img);
}
}
}
if(@copy("".$outpath."/".$outimg."", "".$inpath."/".$inimg."")) {
$f_name = end(explode(".", $inimg));
$f_extension = strtolower($f_name);
if ($f_extension == "jpg" && extension_loaded("gd")) {
$src_img= ImageCreateFromJpeg("".$inpath."/".$inimg."");
$src_width= ImagesX($src_img);
$src_height= ImagesY($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=ImageCreateTrueColor($dest_width, $dest_height);
ImageCopyResampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
ImageJpeg($dest_img, "".$inpath."/".$inimg."", 100);
ImageDestroy($dest_img);
}
if ($f_extension == "png" && extension_loaded("gd")) {
$src_img= imagecreatefrompng("".$inpath."/".$inimg."");
$src_width= imagesx($src_img);
$src_height= imagesy($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=imagecreatetruecolor($dest_width, $dest_height);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagepng($dest_img, "".$inpath."/".$inimg."");
imagedestroy($dest_img);
}
if ($f_extension == "gif" && extension_loaded("gd")) {
$src_img= imagecreatefromgif("".$inpath."/".$inimg."");
$src_width= imagesx($src_img);
$src_height= imagesy($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=imagecreatetruecolor($dest_width, $dest_height);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagegif($dest_img, "".$inpath."/".$inimg."", 100);
imagedestroy($dest_img);
}
}
}
Đăng ký:
Bài đăng (Atom)


