Re: file height and width

From: Date: Wed, 21 Mar 2001 14:08:00 +0000
Subject: Re: file height and width
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-44964@lists.php.net to get a copy of this message
you *could* limit them, imaesx() and imagesy() are what your looking for. what I would say is why? why limit someones image upload when you can easily resize it. display_thumbnail.inc <?php include_once('database.egn'); include_once('time.egn'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); if ( $prod_r = fetch_db_value('product_image', "WHERE product_id = '$product_id' ") ) { if ($prod_r['product_image'] AND ereg('jpeg', $prod_r['product_image_type']) ) { $src_img = imagecreatefromstring($prod_r['product_image']); if (!isset($new_h)) $new_h = 100; $new_w = $new_h * ( imagesx($src_img) / imagesy($src_img) ); $dst_img = imagecreate($new_w,$new_h); imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img)); Header("Content-Type: {$prod_r['product_image_type']}"); imagejpeg($dst_img, '', 100); unlink($fname); exit(); } } Header('Content-Type: image/gif'); readfile("$DOCUMENT_ROOT/image/nopic.gif"); ?> should be able to hack it up :) -- Chris Lee lee@mediawaveonline.com ""george"" <chiefmonkey@wisemonkeydesign.co.uk> wrote in message news:99a9eu$fek$1@toye.p.sourceforge.net... I want to restrict the height and width of a file a user will upload to the how do I do this, is there a function for this. TIA -- george chiefmonkey@my_pantswisemonkeydesign.co.uk remove my_pants to reply P@tty's excellent DW tutorial site http://www.thepattysite.com/dreamweaver/ Jhinuk Chowdhury 's DW FAQ http://people.unt.edu/~jhinuk/DW_FAQ.htm -- 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 (#44964) next »