Jump to content

Recommended Posts

Hello,

 

I am going to create a graffiti database website.

I have over 500 images that i wish to store in a MYSQL datbase.

 

The images will be split into 10 or so sections according to the area their from.

 

I heard it is better to store the image path rather than the image its self in the db, as loading time will be reduced.

 

I also have myadmin, so this could make things easier.

 

So basicaly i want to know how to set that database out??

what tables and fields would i need to produce what i outlined above?

 

i basicaly want sections of thumbnails that link to their appropriate pictures on the DB. and for them to be pulled on to one universal page.

 

any help anyone can give me will me much apreciated. As this is the first time i ever attempted using php-mysql.

Link to comment
https://forums.phpfreaks.com/topic/292-help-please-not-that-hard/
Share on other sites

Well just for that functionality I would only use one table

 

with the fields like

 

picture_ID, section_ID, picture_URL

 

 

the picture_ID\'s would be unique numbers or names just some way to uniquely Identify the picture.

 

from there you can determin the url and what section they belong to.

 

 

if you have a standard way of naming the pictures and they are stored in a standard way, you could get by with only picture_ID and section_ID and build the url dynamically based on your standard.

Link to comment
https://forums.phpfreaks.com/topic/292-help-please-not-that-hard/#findComment-901
Share on other sites

ok, i undersand that i am to store the URL in the images folder.

 

BUT

 

where do i have the actual image folder....simply on the server?

(or at the moment, its all running from htdocs folder. So just in there?)

 

AND

 

i want the images to work as thumbnails. So when a thumbnail is clicked on, what sort of code would be used to pull the image from the appropriate db?

 

a query of some sort, but like i said im well ameture....so....i dont know.

 

but thanks, its great to get some help

Link to comment
https://forums.phpfreaks.com/topic/292-help-please-not-that-hard/#findComment-902
Share on other sites

well you can store the images anywhere on the server that a webpage has access to.

 

as far as the code for the thumbnails

 

I would prolly set it up as just

make the img a link to a php page that will parse the information out

 

the link would look something like showpic.php?pic_id=mycat

 

then in the showpic.php file you would get the pic id from the url using

 

$id = $_GET[\'pic_id\']

 

then use $id to search the database for the url

 

and sections would be pretty much the same

 

a link to a specific section my look like showsect.php?sect_id=animals

 

then in the showsect page you would get the variable

 

$section = $_GET[\'animals\']

 

then search the database for all the pics that have a section id of animals

 

since you are using thumbnails also you might have to create another field in your database with the path to the thumbnail.

 

hope all of this doesn\'t confuse you.

Link to comment
https://forums.phpfreaks.com/topic/292-help-please-not-that-hard/#findComment-903
Share on other sites

yeh, i did think about having the thumb\'s all in the db too....because obviously their will be the same amount of thumbs as their will pics.

 

BUT if im storing all the thumbs in the db,

in the site ideally i would like about 30 on each page.

 

so can you lets say have a 5x6 table (=30) and somehow have the thumbnails dynamicaly* put in the cells. Or would you have to put a path to the individual image in the db, in the cell.

 

Also, (sorry please bear with me) can the thumbnails have their parent images links designated to them in the db. so no html has to be written.

 

So, if you had a selection of thums on a page...and clicked on one

it would go to its big image automatically.

 

 

I think stage one for me is to create a db with a images folder and a thums folder with one of each in them, and try to get it to work fo just one image.

 

thanks for your help and advice though

Link to comment
https://forums.phpfreaks.com/topic/292-help-please-not-that-hard/#findComment-904
Share on other sites

no prob that is the best way to approch any problem is to break it down into smaller problems.

 

don\'t get discouraged you dealling with PHP, MYSQL, and database theory.

 

none of these is \"easy\" by itself stick in there.

There always seems to be someone on these forums to help when you get stuck.

Link to comment
https://forums.phpfreaks.com/topic/292-help-please-not-that-hard/#findComment-905
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.