Resizing multiple images from form

Hello,

I would appreciate if someone could help me. I have created a form to upload information on cars (taxis).
I would like to introduce a classified page onto my website which is meant to inform taxi drivers around my
city what is going on around our trade.

I would like to allow visitors to my site to fill the form below with details of their taxis they want to sell but I
have few problems.

  1. Firstly, I do not know how to resize multiple images into two different sizes. That is, I want each photo to
    be resized (1. maximum width of 150), (2. maximum width of 600).

  2. The files should be named uniquely and then saved in a file named “image”.

  3. I would like visitors the option to load or not load images, but if they do load, how do I ensure they load
    images and nothing else.

I would be grateful if someone can write me a code. thank you.

<table>
<form name = “taxiforsaleform” action = “taxiforsalephp.php” method = “post” enctype = “multipart/form-data”>
<tr>
<td>Brand:</td><td><input type = “text” name = “brand”></td>
</tr>
<tr>
<td>Model:</td><td><input type = “text” name = “model”></td>
</tr>
<tr>
<td>Year of Registration:</td><td><input type = “text” name = “reg”></td>
</tr>
<tr>
<td>Photo 1</td><td><input type = “file” name = “photo1”></td>
</tr>
<tr>
<td>Photo 2:</td><td><input type = “file” name = “photo2”></td>
</tr>
<tr>
<td>Photo 3:</td><td><input type = “file” name = “photo3”></td>
</tr>
<tr>
<td>Contact No:</td><td><input type = “text” name = “contactno”></td>
</tr>
<tr>
<td colspan = “2”><input type = “submit” name = “submit” value = “Submit”</td>
</tr>
</form>
</table>

I would be grateful if someone can write me a code.

I am afraid you have come to the wrong place for that; we will help with any code you have. How else will you learn?

Have a go first and post back when you have tried - there are lots of tutorials for uploading multiple images on the web.

You also need to think about how you link the image to the text - are you using a database?

You are asking for an upload/resize code and some code to display the adverts; quite a bit of work

Sounds like you need to find a content management system if you don’t want to build one yourself. Anything from Joomla to Drupal to WordPress could probably accomplish what your asking with the right add-ons with very little programming on your behalf.

Name your file inputs in your form photo, they will be submitted as an array then and you can easily loop through them.
Next thing is checking if the images are real images. Looking at the extension won’t be enough.
install gd library if it isn’t already.
When images pass the image check you have to find the height and width of the image and calculate the resizing.
Then do the actual resizing. And save both files to disk with a unique name. You can first save the larger image, resize it to smaller version and save smaller file in map thumbs, or add thumb to the name. Also you could reserve a database entry and use the primary key as image name. Look around on the www, much information can be found.