473,499 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

image gallery

3 New Member
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 2026
Atli
5,058 Recognized Expert Expert
Hey.

Check out this article.
It explains how to do exactly what you are trying to do.
Jan 11 '10 #2
saunders1989
3 New Member
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 Recognized Expert Expert
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
saunders1989
3 New Member
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
502
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 would only be a php-library of objects/functions that...
8
4789
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 into a dir called "gallery/". When the client...
10
2219
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 many rows it takes) in order to create a basic...
4
1779
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 thumbnails in one float, the page text in another...
1
2282
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 instance, the first gallery refers to the contents of the...
0
4179
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 using an XML database to load the images and...
5
2093
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 to an external javascript file which I have...
10
6734
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. Have a simple Browser detect script to sort IE...
25
4106
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, just a single file that I just drop into a...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.