Jump to content

image resize on upload


snewpers

Recommended Posts

Hi

 

I need to upload multiple files but the code im currently working with (I didn't start it) is giving me a hard time. What i need is that every image selected is uploaded as is and resized to fit my needs. I do not want to show messages to the user (unless they are sending mp3's and such)... I really need some help, been trying to get this done for hours and hours now :/

 

the template that handles the uploadform is [snippet]:

 

<td align=right valign=top>Images:</td>
<td>
	<form method=post action="AddOffer.php" enctype="multipart/form-data" name=PostForm onsubmit="return CheckOffer();">

...

	<input type=file name="images[]"><br>
	<input type=file name="images[]"><br>
	<input type=file name="images[]"><br>
	<input type=file name="images[]"><br>
	<input type=file name="images[]"><br>
	<input type=file name="images[]"><br>
	<input type=file name="images[]"><br>
	<input type=file name="images[]"><br>
	<input type=file name="images[]"><br>
	<input type=file name="images[]"><br>
</td>

 

The formhandler has this code:

<?
require_once("conn.php");

if(isset($_POST[s1]))
{
if(!empty($_FILES[images][name][0]))
{
	while(list($key,$value) = each($_FILES[images][name]))
	{
		if(!empty($value))
		{
			$NewImageName = $t."_offer_".$value;
			copy($_FILES[images][tmp_name][$key], "re_images/".$NewImageName);

			$MyImages[] = $NewImageName;
		}
	}

	if(!empty($MyImages))
	{
		$ImageStr = implode("|", $MyImages);
	}

}

$catInfo = explode("|", $_POST[selectCategory]);
$CategoryID = $catInfo[0];
$SubcategoryID = $catInfo[1];

$q1 = "insert into re2_listings set 
image = '$ImageStr',
				DateAdded = '$t' ";

mysql_query($q1);

}

header("location:manage.php");
exit();

?>

 

I have tried numorous code [from sites] but none seem to work (well they do, but I cannot get them to work on mine...).

 

Thanks for reading

 

JP

Link to comment
https://forums.phpfreaks.com/topic/42428-image-resize-on-upload/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.