fizzzgigg Posted December 27, 2010 Share Posted December 27, 2010 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? Quote Link to comment Share on other sites More sharing options...
litebearer Posted December 27, 2010 Share Posted December 27, 2010 how are the folders arranged - ie by user? joe's folder, ed's folder etc ect do you want only A user to see their own photo's and comments or can anyone? are there thumbs? Quote Link to comment Share on other sites More sharing options...
fizzzgigg Posted December 27, 2010 Author Share Posted December 27, 2010 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 Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 27, 2010 Share Posted December 27, 2010 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. Quote Link to comment Share on other sites More sharing options...
fizzzgigg Posted December 27, 2010 Author Share Posted December 27, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.