473,562 Members | 2,956 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 2034
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.p hp" 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.p hp" 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 could be used to incorporate folders and images to any kind of website with personal appearance. (Of course administration application should be...
8
4795
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 clicks the "gallery" link, a cgi script could search the gallery/ dir, and create thumbnails of any jpeg images that don't already have a thumbnail...
10
2223
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 thumbnail gallery. I can query and output the data as a single column table, but I'm having problems filling up a 3 column table (with different...
4
1787
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 float, then using absolute positioning (and z-index) to display the image over the second float. The CSS for the thumbnails is from "Web...
1
2290
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 main image folder. The second gallery would be a folder inside the main image folder. Depending on which image is displayed, the first gallery's...
0
4188
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 accompanying captions. The gallery has more than one image and the user can navigate the gallery by clicking forward and backward buttons to take then...
5
2105
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 included the code to below: The file name is imgriders.js - as referred to in source of the html file above. if (document.images) { image1 = new...
10
6744
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 from Netscape. IE is ok but the Netscape browser including Firefox and Safari are not working now. Not sure why. The idea is that when you mouseover...
25
4119
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 directory filled with JPG files - uses eg. GD to generate thumbnails automagically, and saves them into a sub-directory for the next time (I don't want...
0
7655
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7869
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8101
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7935
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5193
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3623
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3608
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2073
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 we have to send another system
1
1191
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.