kofifred — 2012-11-14T15:53:56-05:00 — #1
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).
The files should be named uniquely and then saved in a file named "image".
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.
<form name = "taxiforsaleform" action = "taxiforsalephp.php" method = "post" enctype = "multipart/form-data">
<td>Brand:</td><td><input type = "text" name = "brand"></td>
<td>Model:</td><td><input type = "text" name = "model"></td>
<td>Year of Registration:</td><td><input type = "text" name = "reg"></td>
<td>Photo 1</td><td><input type = "file" name = "photo1"></td>
<td>Photo 2:</td><td><input type = "file" name = "photo2"></td>
<td>Photo 3:</td><td><input type = "file" name = "photo3"></td>
<td>Contact No:</td><td><input type = "text" name = "contactno"></td>
<td colspan = "2"><input type = "submit" name = "submit" value = "Submit"</td>
rubble — 2012-11-14T16:40:26-05:00 — #2
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
oddz — 2012-11-14T17:17:47-05:00 — #3
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.
rvand85 — 2012-11-14T18:09:39-05:00 — #4
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.