I did write the code to do it, but I didn't integrate it into FT yet.
However, my code resized the image into an icon and a main image and put it
in the right folder. I generally change FT so that each item can have many
images and the images are stored in a folder named for the item's ID number,
so FT knows where to look for them.
Then the item page loops through all the icons in that folder.
http://www.luxuryvillas.com for an example.
Chris Mason
Box 340, The Valley, Anguilla, British West Indies
Tel: 264 497 5670 Fax: 264 497 8463
USA Fax (561) 382-7771
Take a virtual tour of the island
http://net.ai/ The Anguilla Guide
Find out more about NetConcepts
www.netconcepts.ai
Talk to me in real time with Instant Messenger: [EMAIL PROTECTED]
Signature
F331 8AD1 36FB B3B0 DF9F D95B 8024 D1EA 7450 D50C
/*function*/
//get the number of the last picture in the folder
function getlastpicnum( $vid )
{
$i=1;
while ( file_exists($vid."/".$i.".jpg"))
{
$i++;
}
return $i;
}
//function to resize image
//infile
//outfile
//vnu=villanumber
function resizeimg( $infile,$vnum )
{
//set temp file
$tmpimg = "/tmp/tmp.pnm";
//get the last picture number in the folder
$picnum=getlastpicnum($vnum);
// CONVERT IMAGE TO PNM
if ($infile)
{
system("djpeg $infile >$tmpimg");
}
else
{
echo("No file");
break;
}
//assign filenames to picfile array
$picfile[0]=($vnum."/".$picnum.".jpg");
$picfile[1]=($vnum ."/icons/".$picnum.".jpg");
// scale image using pnmscale and output using cjpeg
system("pnmscale -xy 350 350 $tmpimg | cjpeg -smoo 10 -qual 50
>$picfile[0]");
system("pnmscale -xy 100 100 $tmpimg | cjpeg -smoo 10 -qual 50
>$picfile[1]");
return $picfile;
}
/* page code
<?php
//upload.php3
//script to handle uploaded pictures
include("includes/vars.php3");
include("common.php3");
include("sessioncode.php3");
/********************/
include("head.php3");
//resize image and put in correct folder
// upload directory where the file will be stored
// relative to where script is run
//test for file
if ( !($imgfile=="none") )
{
// get file extension (fn at bottom of script)
$pext = getFileExtension($imgfile_name);
//capture image name
$img_name=$imgfile_name;
$newfile = $uploaddir . "/" . $imgfile_name;
echo($imgfile);
// move file to proper directory using the
if (!copy($imgfile,$newfile))
{
// if an error occurs the file could not
// be written, read or possibly does not exist
echo "Error Uploading File.";
exit();
}
// delete temp file
unlink($imgfile);
}
else //there's no file
{
echo "You must supply a valid file<BR><BR>";
exit();
}
//check for item directory
if (!( is_dir($id) ) )
{
mkdir("$id",0777);//make directory and set permissions
mkdir($id."/icons",0777);//make icon directory
}
//-- RE-SIZING UPLOADED IMAGE
// for my example I only want to resize if the image is
// larger than 100 x 100
$imgsize = GetImageSize($newfile);
// check size
//0=width, 1=height
if (($imgsize[0] > 250) || ($imgsize[1] > 200))
{
// Resize image
if ($pext == "jpg")
{
$picfile=resizeimg($newfile,$id);
}
else
{
echo("<H1>ERROR</H1>Image Extension Unknown.<BR>");
echo("Please upload a JPG image with the extension .jpg ONLY.");
exit();
}
}
print("<TABLE WIDTH=\"400\" BORDER=\"1\"><TR VALIGN=\"TOP\">\n<TD>");
if ( file_exists($picfile[1]) )
{
printf("<H2>Icon </H2><A HREF=\"%s\"><img
src=\"%s\"></A><BR>",$picfile[1],$picfile[1]);
print("<A HREF=\"admin.php3?action=photoselect&id=$id&ses=$ses\">Upload
another photo to this item</A>\n");
}
print("</TD>\n<TD>");
if ( file_exists($picfile[0]) )
{
printf("<H2>Image %s</H2> <img src=\"%s\">",$picfile[0],$picfile[0]);
}
print("</TD></TR></TABLE>\n");
include("pagefoot.php3");
?>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Site: http://www.working-dogs.com/freetrade/
Problems?: [EMAIL PROTECTED]