Jump to content

Image Viewer


fizzzgigg

Recommended Posts

I am working on a site of my own, and I have run into a jam.

 

The situation:

A user logs in reads their assignment, and then goes out and takes pictures. Once they upload their pictures I will comment on them, and they can see the pictures and my comments.

The problem:

I currently have a successful system of uploading the pictures and I have the URL's stored a mysql database. My problem is finding a good photo gallery to customize for my needs. I only have 5-15 photos per folder. And I want the gallery only to show the photos in that one folder and read my comments.

 

Any directions for me to start looking?

Link to comment
Share on other sites

Yes its arranged by: /file_upload/uploads/user/assignment/

 

I only want users to see their own files, and my comments on their photos.

I havn't thought about thumbnails, but they would be useful for sure.

 

Down the road I want to have the imags resized to safe space, I only need 72ppi on their photos at a 4x6 view, but first I wanted to start working on a gallery.

 

Your thoughts?

 

Adam

Link to comment
Share on other sites

You say the files (for each user) are stored in separate folders, but that the URLs for the photos are also stored in the database. Not sure how you are storing the data, but you should probably be storing the "root" folder location as part of the user table and then store the image file names in a separate table associated with each user.

 

Anyway, you *could* determine which images to show a user by using file functions to read the images in the folder, but if you are already using a database - then use it. So, when a users access the page to see their photos, just do a query to get the root folder and the image names based upon the logged in user. Then process the results to display the images on the page. I would also assume that your comments are included as part of the image database.

 

However, you now have the problem that a user could check the path for any of the displayed images and then use that path to potentially access images by other users (but not your comments). To prevent that you would want to obfuscate the actual path and (even better) put the images in a location that is not directly accessible.

 

To do this, first put the images in a location that is not web accessible. Then when you query the images you would get the unique ID of the images and create your image tags somethign like this:

<img src="http://www.mysite.com/get_image.php?id=123"/>

 

You would then create the page get_image.php to use the passed ID to determine the file system path to the image, read the image and pass the image to the user. So, the user does not know the path and cannot access the file directly.

Link to comment
Share on other sites

I like the unique ID idea. I wasn't too concerned with people peeping on other images... but this simple manuever will eliminate. To answer your question... the images are stored in folders, and the database links their names and locations, but I can easily pull the unique id from that table.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.