Re: Resizing an image (dynamic)

From: Date: Sun, 03 Dec 2000 08:09:58 +0000
Subject: Re: Resizing an image (dynamic)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-28413@lists.php.net to get a copy of this message
ImageCopyResized sounds like the way to go to me. Toby Butzon [ criticism spurs improvement ] ----- Original Message ----- From: "Lauri Vain" <optima@hot.ee> To: "PHP" <php-general@lists.php.net> Sent: Sunday, December 03, 2000 3:03 AM Subject: [PHP] Resizing an image (dynamic) : Hello, : : I have to resize an image to reduce the loading time (there will be thumbnails, : which have to be resized, and there will be full sized images). : : Now, the images that will be inserted into the DB have the dimensions height=300 : and width=400. The dimensions for the thumbnail have to be 4 times smaller. : : /************ code to show images **************/ : <?if (!isset($id) || empty($id)) { : echo "Looking for images ?"; : } else { : $mysqlhost = "localhost"; : $mysqluser = "**********"; : $mysqlpassword = "*******************"; : mysql_connect($mysqlhost, $mysqluser, $mysqlpassword) or die : ($mysql_db_connect_error); : : $pilt_q = mysql_db_query(DBname,"SELECT pilt,tyyp FROM pildid WHERE : idep='$id'"); : $pilt_k = mysql_fetch_array($pilt_q); : Header("Content-Type: image/pjpeg"); : print($pilt_k["pilt"]); : }?> : /************ end code to show images **************/ : : : /************ code to insert images **************/ : if (!empty($pilt) && strlen($pilt)>6) { : $size = GetImageSize ("$pilt"); : $fd = fopen($pilt, "r"); : echo "pildi suurus $size[0], $size[1], id=$id"; : $piltdata = addslashes(fread($fd, filesize($pilt))); : fclose($fd); : mysql_db_query(DBname,"INSERT INTO pildid (tyyp, pilt) VALUES : ('$pilt_type','$piltdata')", $db); : $piltid = mysql_insert_id($db); : } : /************ end code to insert images **************/ : : : Any ideas how I could resize the images to 100*75 pixels (from 400*300 pixels)? : Would I do it with "ImageCopyResized"? : : Yours, : Lauri Väin : : : -- : PHP General Mailing List (http://www.php.net/) : To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net : For additional commands, e-mail: php-general-help@lists.php.net : To contact the list administrators, e-mail: php-list-admin@lists.php.net : :

« previous php.general (#28413) next »