472,352 Members | 1,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 software developers and data experts.

image gallery

Hi,

my goal is to create a website with an image gallery. i have about 6 buttons at the bottom of the page whcih when clicked will take you to a different album of photos.

i have created the login page and the next step is to create the upload form to a database.

these are the tables i am going to intened to use:

TABLE: Gallery
gID - auto incrementing unique ID
gDescription - Description

TABLE: Images
iID - auto incrementing unique ID
iImage - BLOB field to hold the image
iUploaderID - ID from USERS table
iUploadDate - Date of upload
iComments - image comments submitted with the image
iGalleryID - ID from GALLERY table

but i have no idea how to upload the image to the database. i know you should upload an actual file but just a path to a folder. could anyone assist me on how to do this please.

Thanks
Jan 10 '10 #1
4 1946
Atli
5,058 Expert 4TB
Hey.

Check out this article.
It explains how to do exactly what you are trying to do.
Jan 11 '10 #2
thanks for your reply. i have got it all to work so the file uploads to the folder images which is what i wanted. but isnt this way storing the file on the database. isnt it better to point the directory to the path of the file as it is faster? or is your way fast?

another question is if i stick with your way of uploading the file how would i display the images. do you have a tutorial?

thanks
Jan 11 '10 #3
Atli
5,058 Expert 4TB
Yes, it is generally best to store the images on the file-system and save just the path to the image in the database. Storing the image itself inside the database - like my article demonstrates - tends to create extra overhead, which in turn decreases performance.

If you don't have any reason to put the image into the database, you really should avoid it.

another question is if i stick with your way of uploading the file how would i display the images. do you have a tutorial?
That depends on what you mean. If you are just talking about downloading individual images, then phases #3 and #4 of the article do just that.
However, If you want to display the image as a part of a HTML page, all you would have to do is create a <img> tag and set the src attribute to the "get_file.php" script.

Basically, in line #37 in phase #3 of the article, you would just have to change:
Expand|Select|Wrap|Line Numbers
  1. <td><a href='get_file.php?id={$row['id']}'>Download</a></td>
to:
Expand|Select|Wrap|Line Numbers
  1. <td><img src='get_file.php?id={$row['id']}' alt='{$row['name']}'></td>
The src attribute of the <img> tag expects to get sent a proper image content-type and valid image data. It doesn't care whether or not that is coming from an actual image or a PHP script that "imitates" an image.

The "get_file.php" script just sends back the content-type and data for the file ID you pass to it, so if that file is an image, the response from the script will "imitate" an image. A browser would see no difference between that and if the same image had been save on - and served from - the file-system.
Jan 12 '10 #4
when i try you phase 3 code it just prints out the files names and description like shown:

general shop.jpg 0 523861 2010-01-11 14:29:24 general shop.jpg

doesnt display a image. do i have to have phase 4 aswell to display it?

what i want to do is create a image gallery of the images that are stored on the database, preferablly i dont want to store any files on the database just a file path do you have a tutorial for that?

thanks for helping
Jan 12 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Perttu Pulkkinen | last post by:
Does anybody know a php-based image gallery, where final looks of the actual site would not be determined by the application? I mean that there...
8
by: Chris Dewin | last post by:
Hi. I run a website for my band, and the other guys want an image gallery. I'm thinking it would be nice and easy, if we could just upload a jpg...
10
by: ste | last post by:
Hi there, I'm trying to query a MySQL database (containing image data) and to output the results in a HTML table of 3 columns wide (and however...
4
by: RE Kochanski | last post by:
I have attempted to use the CSS techniques from two or three sites to create a CSS only image gallery. I am muddling the affair by placing the...
1
by: gescom | last post by:
My goal is to create essentially two galleries on a single page, in which the first gallery determines what the second gallery displays. For...
0
by: numbnutz | last post by:
Hi, I am currently working on an XML Gallery for my girlfriend's brother who is a photographer. I have created a flash front end template and am...
5
by: dabhand | last post by:
Hi This page http://www.dabhand.co.nz/ayupdev/gallery-riders.html works great in IE but not in Firefox... any help would be appreciated. It refers...
10
by: cjparis | last post by:
Hello everyone. If anyone can give me a hand I would be gratefull Am doing a site which requires a moving element and have used DHTML to do it. ...
25
by: Gilles Ganault | last post by:
Hello I've been googling for a couple of hours, but still haven't found what I need: - really simple PHP-based image gallery software. Ideally,...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.