<?php
$height= 150;
$width= 150;
// Content type
header('Content-type: image/jpeg');
header('Content-type: image/jpg');
header('Content-type: image/gif');
header('Content-type: image/png');
if(!$filename)
$filename="./images/nopic.jpg";
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
$image = imagecreatefromjpg($filename);
$image = imagecreatefromgif($filename);
$image = imagecreatefrompng($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
imagejpg($image_p, null, 100);
imagegif($image_p, null, 100);
imagePNG($image_p, null, 100);
ImageDestroy ($image_p);
?>
$height= 150;
$width= 150;
// Content type
header('Content-type: image/jpeg');
header('Content-type: image/jpg');
header('Content-type: image/gif');
header('Content-type: image/png');
if(!$filename)
$filename="./images/nopic.jpg";
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
$image = imagecreatefromjpg($filename);
$image = imagecreatefromgif($filename);
$image = imagecreatefrompng($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
imagejpg($image_p, null, 100);
imagegif($image_p, null, 100);
imagePNG($image_p, null, 100);
ImageDestroy ($image_p);
?>
Comment