Reply to PHP JPEG resize

Your name:

Reply:


Posted by Willem-Jan Selen on 10/13/05 11:29

Hi All,

I am currently doing a website redesign. I only have 1 problem.

The website has a large gallery inwhich the picures are uploaded and resized
into a thumbnail, medium size and a larger size. All without a watermark.

Now the problem is the medium sized picture. Due to the redesign the area
where the picture is desplayed, the picture doesn't fit :(

I use the following script to display the image :

<?
require("../../dbfuncs.php");


$sql = "SELECT ID, imgname FROM modgalimg WHERE ID='$id'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
$subID=144;
if(!isset($nolog)) logEntry("modgalimg", $id, "imgname");

if(strstr($row['imgname'], ".jpg")) $im =
imagecreatefromjpeg("$datastore/".$row['imgname']);
if(strstr($row['imgname'], ".png")) $im =
imagecreatefrompng("$datastore/".$row['imgname']);
$logo = imagecreatefrompng(dirname($SCRIPT_FILENAME)."/logo.png");



$src_w = ImageSX($im);
$src_h = ImageSY($im);
$can_img = imagecreatetruecolor($src_w, $src_h);
ImageColorTransparent($logo, imagecolorat($logo,0,0));
imagecopy($can_img, $im, 0,0,0,0, $src_w, $src_h);
imagecopymerge($can_img, $logo,
$src_w-ImageSX($logo),$src_h-ImageSY($logo),0,0, ImageSX($logo),
ImageSY($logo),100);
ImageJPEG($can_img,'',100);
imagedestroy($logo);
imagedestroy($im);
imagedestroy($can_img);

?>

Now I need to resize the picture in this script without saving the actual
size. The image which needs to be resized is image stored in the $datastore
directory. ofcourse it needs to be resized in correct proportions.

I have tried different options but I only get black images either with or
without the watermark.

So if anybody can be of any assistance, it will make me a very happy person
;-)


Kind regards,


Willem-Jan

[Back to original 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

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