Hiển thị các bài đăng có nhãn script size. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn script size. Hiển thị tất cả bài đăng

Thứ Hai, 12 tháng 6, 2017

Chỉnh kích thướt hình ảnh javascript

HTML:
<a class="pic" href="#"><img src="img" alt="tieude" onload="resize_f(this,140,100)" height="100" width="90" style="margin-top: 0px; margin-left: 24.9296px; display: block;"></a>

****JAVASCRIPT:
Download: tại đây

#CODE PHP#
function laychieuronglamchuan ($link,$width,$maxheight){;
$info=@getimagesize($link);
if($info[1]!=0){
$tyle=$info[0]/$info[1];
$chieurong=$width;
$chieucao=$chieurong/$tyle;
$max=$maxheight;
if($chieucao>$maxheight){
$chieucao=$max;
$chieurong=$chieucao*$tyle;
}
}else{
$chieurong=$width;
//$chieucao=$chieurong/$tyle;
$chieucao="";
}
$return[0]= $chieurong;
$return[1]= $chieucao;
return $return;
}

//code images

$image=$data[$i]["images"];//thay link
$thum= new thumnail();
if(file_exists(INCLUDE_PATH."uploads/shop/pic/".$image) && $image!="")
{
if(!file_exists(INCLUDE_PATH."uploads/shop/pic/small_".$image))
{

$outpath="uploads/shop/pic";
$inpath="uploads/shop/pic";
$outimg=$image;
$inimg="small_".$image;
$insize=180;
thumbs($outpath,$inpath,$outimg,$inimg,$insize);
}
$link="".$site_live."uploads/shop/pic/small_".$image."";
$width=248;
$max=190;
//print_r(array($link,$width,$max));
$info=laychieuronglamchuan ($link,$width,$max);
$width=$info[0];
$height=$info[1];
$pic="<img src=\"".$link."\" width=\"".$width."\" height=\"".$height."\" >";
}else{
$pic="";
}