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
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

Link to comment
Share on other sites

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?

   

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.