Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
KaRo каза:Закакво изобщо ти е скрипт? <img src='$img' width='еди колко' height='еди колко' /> ??
slideR каза:Значи снимките ще са макс 1000px x 1000px. Ако работи с този размер го дай.
<?php
$max_width = 150;
$max_height = 150;
$upfile = $_GET['image'];
$type = getimagesize($upfile);
Header("Content-type: ".$type['mime']."");
$size = getimagesize($upfile); // Read the size
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if( ($width <= $max_width) && ($height <= $max_height) )
{
$tn_width = $width;
$tn_height = $height;
}
elseif (($x_ratio * $height) < $max_height)
{
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else
{
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
ini_set('memory_limit', '1024M');
if($type['mime'] == "image/jpeg") {
$src = imagecreatefromjpeg($upfile);
$dst = imagecreatetruecolor($tn_width, $tn_height);
imagecopyresized($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
imagejpeg($dst);
ImageDestroy($src);
ImageDestroy($dst);
}
elseif($type['mime'] == "image/png") {
$src = imagecreatefrompng($upfile);
$dst = imagecreatetruecolor($tn_width, $tn_height);
imagecopyresized($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
imagepng($dst);
ImageDestroy($src);
ImageDestroy($dst);
}
elseif($type['mime'] == "image/gif") {
$src = imagecreatefromgif($upfile);
$dst = imagecreatetruecolor($tn_width, $tn_height);
imagecopyresized($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
imagegif($dst);
ImageDestroy($src);
ImageDestroy($dst);
}
elseif($type['mime'] == "image/bmp") {
$src = imagecreatefrombmp($upfile);
$dst = imagecreatetruecolor($tn_width, $tn_height);
imagecopyresized($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
imagebmp($dst);
ImageDestroy($src);
ImageDestroy($dst);
}
?>