I currently have a script that creates a web page that contains photos and information. Everything is working as it should but I have a problem with poeple uploading photos that are too large (from thier Digi Cam).
I know of many scripts out there to resize images and I have code that works but my problem is that I do not know how to "impliment" this code into my already exisiting script.
The script I have puts the photos uploaded into an array and names them img1.jpg, img2.jpg, and so on - UP TO 12 photos. So the user can upload No photos or any number between 1 and 12.
I don't need thumbnails, I need to resize these images - based on a maximum) width. Again, I have a script that can do this but I have been trying to for days (without any luck) to impliment this into the "html page creating script" I already have.
Would anyone be willing to help me with this?
Here is the code that makes the HTML page and uploaded the photos:
Code: Select all
function make_gallery($sTemplatePath, $scoipagesBase){
// note: images are numbered img1 - img[n]
// note: we have to include the address field in any array
global $Member_ID;
$sUrlAddress = str_replace(' ', '', $_REQUEST['address']);
$nPicCount = 0;
for($i = 0; $i < count($_FILES['pictures']['name']); $i++) {// loop through picture uploads
if(stristr($_FILES['pictures']['type'][$i], 'image/')){ // only accept picture files
if (is_uploaded_file($_FILES['pictures']['tmp_name'][$i])){
$nPicCount++;
// Get The Extension Of The File(s) //
$picFormat = explode(".", basename($_FILES['pictures']['name'][$i]));
$picFormat = strtolower( $picFormat[count($picFormat) -1] );
// Copy File(s) To The Folder //
copy($_FILES['pictures']['tmp_name'][$i],
"$scoipagesBase/$Member_ID/$sUrlAddress/img$nPicCount.$picFormat");
// Create An Assosiative Array That Will Be Used To Create The Gallery //
$picArray["img$nPicCount"] = "img$nPicCount.$picFormat";
}
}
}
if(count($picArray) > 0){// check to see that there were some pics
while(list($sName, $sValue) = each($picArray)){
$picArray[$sName] = "<img src=\"$sValue\" border=0>";
}
// Add The First Picture To The Index Page That Was Already Created //
make_page("$scoipagesBase/$Member_ID/$sUrlAddress/index.htm",
$scoipagesBase, 'index.htm', array('img1' => $picArray['img1'], 'address' => $_REQUEST['address']) );
}
$picArray['address'] = $_REQUEST['address'];
// Make The Gallery Page (Second Page) //
make_page($sTemplatePath, $scoipagesBase, 'pictures.htm', $picArray);
}Code: Select all
toCode: Select all
for better viewing[/size][/color]