Jump to content

Best way to display images on webpage?


LiamH

Recommended Posts

Hi all.

 

I'm trying to update my website so that screen shots on an article page, when selected will open up a new window and display all of the images associated with that article. But I'm really not sure how to go about it.

 

Would the best way to have 10 individual columns for screens in the articles table, or is it better to have just one column with all of the screenshot information contained in that?

 

I honestly have no idea how to go forward with this, so if anyone has any helpful hints or advice, it would help greatly.

Link to comment
https://forums.phpfreaks.com/topic/166824-best-way-to-display-images-on-webpage/
Share on other sites

I went along the route of having 10 rows in the articles table, and can display the screenshots on the articles page no problem. It's when it comes to having them display in the image viewer page that I become a bit stuck. I'd only want one image to display at a time, so would need some form of page pagination, but with only the images location stored in the articles table, I'm not entirely sure how to go about doing it.

 

And apologies for placing it in the wrong bit

You should have done it this way:

 

Article table:

article_id INT(11) NOT NULL AUTO_INCREMENT,

article_name TEXT NULL

<....> etc

 

Screenshot table:

CREATE TABLE IF NOT EXISTS screenshot(
   screenshot_id INT(11) NOT NULL AUTO_INCREMENT,
   article_id INT(11) NOT NULL,
   directory TEXT NOT NULL,
   INDEX article_index(article_id),
   PRIMARY KEY(screenshot_id))

 

Say I'm on article_id 32 and I click the screenshots page, your code should simply search through the screenshot table and pluck out any screenshots that have the article_id 32. Do you understand what I'm talking about?

   

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.