Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ///////////////////////////////////////////////////////
- // FlowerBoy paveiksleliu mazinimo varikliukas v.1.2 //
- ///////////////////////////////////////////////////////
- $filename = realpath($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$_GET['f']);
- if (isset ($_GET['p'])) {
- $plotis = $_GET['p'];
- }
- if (isset ($_GET['a'])) {
- $aukstis = $_GET['a'];
- }
- if (isset ($_GET['max'])) {
- $dydis = getimagesize($filename);
- if ($dydis['0'] <= $dydis['1']) {
- $aukstis = $_GET['max'];
- }
- if ($dydis['0'] > $dydis['1']) {
- $plotis = $_GET['max'];
- }
- }
- if (isset ($_GET['min'])) {
- $dydis = getimagesize($filename);
- if ($dydis['0'] >= $dydis['1']) {
- $aukstis = $_GET['min'];
- }
- if ($dydis['0'] < $dydis['1']) {
- $plotis = $_GET['min'];
- }
- }
- header("Content-type: image/jpeg");
- $source = imagecreatefromjpeg($filename);
- if ($plotis != "") {
- $thumbX = $plotis;
- $imageX = imagesx($source);
- $imageY = imagesy($source);
- $thumbY = (int)(($thumbX * $imageY) / $imageX);
- }
- if ($aukstis != "") {
- $thumbY = $aukstis;
- $imageX = imagesx($source);
- $imageY = imagesy($source);
- $thumbX = (int)(($thumbY * $imageX) / $imageY);
- }
- $dest = imagecreatetruecolor($thumbX, $thumbY);
- imagecopyresampled($dest, $source, 0, 0, 0, 0, $thumbX, $thumbY, $imageX, $imageY);
- imagejpeg($dest, "", "100");
- imagedestroy($dest);
- imagedestroy($source);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment