You are here: Re: image rsesizer « All PHP « IT news, forums, messages
Re: image rsesizer

Posted by Steve on 10/31/06 14:28

| ps please ignore top posting idiots !

wow, that's a lot of code and required libraries for something as simple as:

<?
require_once 'site.cfg.php';
$fileName = $_REQUEST['fileName'] ? $_REQUEST['fileName'] :
$_REQUEST['altImage'];
$maxSize = $_REQUEST['maxSize'] ? $_REQUEST['maxSize'] : 200;
$filePath = $site->imagesDirectory;
$fileData = @file_get_contents($filePath . $fileName);
$originalImage = @imagecreatefromstring($fileData);
@list($imageWidth, $imageHeight, $imageType, $imageAttributes) =
@getimagesize($filePath . $fileName);
$newImageHeight = $imageWidth < $maxSize ? $imageHeight : ($imageHeight /
$imageWidth) * $maxSize;
$newImageWidth = $imageWidth < $maxSize ? $imageWidth : $maxSize;
$thumbNail = @imagecreatetruecolor($newImageWidth, $newImageHeight);
@imagecopyresampled(
$thumbNail,
$originalImage,
0,
0,
0,
0,
$newImageWidth,
$newImageHeight,
@imagesx($originalImage),
@imagesy($originalImage)
);
@imagejpeg($thumbNail);
@imagedestroy($thumbNail);
@imagedestroy($originalImage);
?>

i also love your code standardization - like declaring all your variables on
ONE line and using HIGHLY intuitive variable names like $lala. you're a
winner!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация