Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199807

[PHP3] 2 new functions From: Jeremiah Davis (jdavis <email protected>)
Date: 07/03/98

I just created two functions to help out with some of the applications we
are building. They are img_upload() and img_resize()..

img_upload() -- Takes the input from a file upload form field, verifies
that the file is an image, determines if the file name is in use, and
copies the file to the destination (to a unique file name if needed).

returns an array with the following:
index 0 -- name of the image file
index 1 -- path to the image file

use --
img_upload(var field name, var image name, string "destination path");

example--

if the form field was named image:

$img-array = img_upload($image,$image_name,"uploads/images");

echo '<IMG SRC="'.$img-array[1].'">';
   or
echo '<IMG SRC="uploads/images/'.$img-array[0].'">';

img_resize() -- Resizes an image to the specified size, either by height,
width or automatically, then copies the thumbnail to a destination.

returns an array with the following:
index 0 -- name of the source image
index 1 -- path to the source image
index 2 -- name of the resized image
index 3 -- path to the resized image

use --
img_resize(string 'path to source image', string 'path to thumbnail',
string mode, int size);

example --

if used with img_upload (upload field name is image):

$imginfo = img_upload($image,$image_name,"upload/files");

$thumbinfo = img_resize($imginfo[1],"upload/thumbs/".$imginfo[0],"a",100);

The code for the functions is available at the PHP example archive, under
the catagory New functions. And at
http://web-cave.freeway.net/graphicfunctions.phps

Let me know what you think!
Thanks!

Jeremiah Davis
jdavis <email protected>

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive: http://www.tryc.on.ca/php3.html