Hi
I was hoping you could let me know in general terms the best way to achieve what I want.
I currently have a div with various bits of text generated from a table. This text is fed into the table via a form and it works nicely.
I now need to include an image in each of these divs to correspond with the particular bit of text and the image needs to be resized to a reasonable thumb size.
I'm unsure if it's possible to include the image upload (like this one: viewtopic.php?t=41743) within the same form that updates the table with the text content or whether I'll need to create a separate form entirely. If a separate form is required then how would I ensure the image is attached to the correct table entry?
Many thanks in advance.
Desperate - need help with image uploading/resizing
Moderator: General Moderators
Desperate - need help with image uploading/resizing
Last edited by Noobie on Fri Apr 28, 2006 7:45 am, edited 1 time in total.
Ah great, that makes life a lot easier!
I suppose then I'd just include
in the form tag and add in the extra input box as per that tutorial?
I suppose then I'd just include
Code: Select all
enctype="multipart/form-data"Sorry chaps - could I ask for help again?
I've been playing with this for a few days now with no luck whatsoever and my time is rapidly running out (like tomorrow).
My uploading form:
The addoffer.php page is:
I just can't get my head around how to integrate the type of upload and thumb resizing that appears in the previously mentioned tutorial into what I already have.
Thank you in advance.
I've been playing with this for a few days now with no luck whatsoever and my time is rapidly running out (like tomorrow).
My uploading form:
Code: Select all
<form enctype="multipart/form-data" action="addoffer.php" method="post">
<input type="hidden" name="id" value="NULL" />
<label for="name">Enter the Company Name</label><br />
<input type="text" name="name" title="input name" id="name" size="20" /><br />
<label for="photo">Upload Photo</label> <input type="file" name="photo" size="20"><br />
<label for="text">Enter Offer Details:</label><br />
<textarea name="text" id="text" rows="5" cols="50"></textarea><br />
<input type="submit" value="Submit Info" />
</form>Code: Select all
<?php
$dbh=mysql_connect ("localhost", "USERNAME", "PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("TABLENAME");
//making variables
$id = $_POST['id'];
$name = $_POST['name'];
$text = $_POST['text'];
$photo = $_POST['photo'];
// the query
$result=MYSQL_QUERY("INSERT INTO TABLENAME (id,name,photo,text)".
"VALUES ('NULL', '$name', '$photo', '$text')");
//confirm
echo "The entry has been added to the Sponsors Details. <p><a href=\"admin.html\">Back to the Admin Page</a></p>";
?>Thank you in advance.
Desperate - need help with image uploading/resizing
Obviously I'm really thick but I still can't get what I need. I can upload the image to the db (at least the blob field says it has a 5k file in it) but this isn't the "right way" to deal with images in a db is it? I can upload and resize an image as per that tutorial. What I can't achieve is combining those two steps.
I need to be able to upload and resize an image with the filename (presumably this is better) stored in the db along with the file name etc (all the text fields are already in place and working fine).
I need to be able to call the image along with the text on a page.
I need to be able to delete the row if necessary and get rid of the thumbnail wherever that's stored.
If I can't get anyone to help me then I'm willing to pay for someone to do this for me - PM me if you are interested.
I need to be able to upload and resize an image with the filename (presumably this is better) stored in the db along with the file name etc (all the text fields are already in place and working fine).
I need to be able to call the image along with the text on a page.
I need to be able to delete the row if necessary and get rid of the thumbnail wherever that's stored.
If I can't get anyone to help me then I'm willing to pay for someone to do this for me - PM me if you are interested.