Jump to content

How can i display the photo for the photo album ?


Rommeo

Recommended Posts

Hi

 

i m trying to build a website for my photo album. As i heard best way to do this is "saving photo info in mysql / uploading photo to a directory" So i did. I upload the photo and save the information of the photo in mysql. but now my problem is how can i display these photos for an order ?

 

my table looks like ;

id || place || size || number 
1     usa        big        1
2     usa        big        2 

and a photos name is like this : "usa_big_1.jpg"

 

And I wanna display 3 big photos at the top and 3 small photos at the bottom in my page.  I thought about making 2 loops like ;  " img source = usa_big_$i " etc. but at that time the area for the third photo will be empty if there are 2 photos for any place. So is there any way to make a query for to display a photo that is saved in mysql ( like "display from table where photo size = big && number = 1" ?? or what is the easy way for to do this ? Should I make a query for each order ?

I ll be glad if you can help.

 

Thanks in advance.

Your method of storing the image data is a bit funny. Why not store the actual image filename in the database?

To sort the images why not just have a sort order field in the database table?

You could also store the image size in a database field using the results of getimagesize(); and then sort the images using these values.

Blade :

But i ll use the photos in different places. Not from top to bottom..

I mean there will be some text ( data ) taken from mysql that is about the information of the place.

like "

photo (big )

usa is a country that is.. ( data taken from mysql )

photo( big )

for to live there ( data taken from mysql )

photo ( big )

 

photo(small) photo (small ) photo (small )

 

I think at that time, I should put quaries in while loop ..

Your method of storing the image data is a bit funny. Why not store the actual image filename in the database?

To sort the images why not just have a sort order field in the database table?

You could also store the image size in a database field using the results of getimagesize(); and then sort the images using these values.

Actually the table is simplified.. There are other fields etc. And I need those fields. I just want to know how can i do this ? want to know the way how other people did that. and that size is a result of getimagesize() function.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.