Viewing File: /people/testlab/www/testlab.com.pl/panel/image.php
<?php
include('../config.php');
include('../inc/db.php');
$db = new DBConnect();
$sql="select * from ustawienia where typ='s".$_GET['page']."'";
$db->query($sql);
$row=$db->fetchrow();
$params=explode(";",$row['text']);
$typ = end(explode(".",$_GET['img']));
header("Content-Type: image/".$typ);
if ($typ=='jpg') $img = imagecreatefromjpeg("../".$_GET['dir']."/".$_GET['img']);
if ($typ=='png') $img = imagecreatefrompng("../".$_GET['dir']."/".$_GET['img']);
if ($typ=='gif') $img = imagecreatefromgif("../".$_GET['dir']."/".$_GET['img']);
$width = imagesx($img);
$height = imagesy($img);
$height_mini = $params[1];
$width_mini = round(($params[1]/$height)*$width);
$img_mini = imagecreatetruecolor($width_mini, $height_mini);
imagesavealpha($img_mini, true);
$trans_colour = imagecolorallocatealpha($img_mini, 0, 0, 0, 127);
imagefill($img_mini, 0, 0, $trans_colour);
imagecopyresampled($img_mini, $img, 0, 0, 0, 0, $width_mini , $height_mini, $width , $height);
if ($typ=='jpg') imagejpeg($img_mini, null, 100);
if ($typ=='gif') imagepng($img_mini);
if ($typ=='png') imagepng($img_mini);
imagedestroy($img_mini);
?>
Back to Directory
File Manager