Hi,
long time no see!
I need a simple code to upload an image to a page on a website, and then have a commenting system below the image.
I have PHP code to upload an image to an image folder but not sure how I go about uploading and displaying the image on the page.
this IS NOT homework, this is just a little project that I'm working on purely for my own entertainment purposes, any help would be greatly appreciated, any links etc.
Thanks for your time.
Simple picture upload script
Page 1 of 15 Replies - 5826 Views - Last Post: 19 January 2011 - 09:17 AM
Replies To: Simple picture upload script
#2
Re: Simple picture upload script
Posted 19 January 2011 - 03:54 AM
#3
Re: Simple picture upload script
Posted 19 January 2011 - 04:30 AM
Dogstopper, on 19 January 2011 - 03:54 AM, said:
The new search bar is very handy. How about this:
http://www.dreaminco...mages-with-php/
http://www.dreaminco...mages-with-php/
thank you very much, I did search but I wasn't sure what I found was any use to me (if that makes sense) this tutorial is very helpful indeed!
cheers
#4
Re: Simple picture upload script
Posted 19 January 2011 - 05:58 AM
Hi,
If you are already uploading the image to your web server all you need to do is make an entry into a table of your database that corresponds with the image name. Then use that information as the src attribute of your <img> tag.
If you are already uploading the image to your web server all you need to do is make an entry into a table of your database that corresponds with the image name. Then use that information as the src attribute of your <img> tag.
#5
Re: Simple picture upload script
Posted 19 January 2011 - 06:26 AM
i'm using this part of the script to display the images..
how would I organise this, at present the images are just displayed under each other, I would like them in rows, say 2 across, how do I acheive this?? css divs??
cheers
<?php
// Get our database connector
require("includes/conn.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dream in code tutorial - List of Images</title>
</head>
<body>
<div>
<?php
// Grab the data from our people table
$sql = "select * from people";
$result = mysql_query($sql) or die ("Could not access DB: " . mysql_error());
while ($row = mysql_fetch_assoc($result))
{
echo "<div class=\"picture\">";
echo "<p>";
// Note that we are building our src string using the filename from the database
echo "<img src=\"images/" . $row['filename'] . "\" alt=\"\" /><br />";
echo $row['fname'] . " " . $row['lname'] . "<br />";
echo "</p>";
echo "</div>";
}
?>
</div>
</body>
</html>
how would I organise this, at present the images are just displayed under each other, I would like them in rows, say 2 across, how do I acheive this?? css divs??
cheers
#6
Re: Simple picture upload script
Posted 19 January 2011 - 09:17 AM
Yes, the layout of the images would be a CSS issue. You could use divs sure.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote







|