Search

bbPress Showcase » bbPress Chat

closed Thumbnail for Topics

RSS
  1. enatom
    enatom

    junior member
    Joined: Aug '10
    Posts: 9

    offline

    Hi I want to make a Image Bulleting board sort of. But more importantly is there a way for the user to upload a Thumbnail for a topic(to be shown on the frontpage besides the topic title). (not nessesarily listed as an attachment inside the post, but as a thumbnail for the post shown on the frontpage) like a wordpress blog post almost?

    So beside each topic, would be a 30x30 thumbnail of the topic.

    Anyone know where i can start with this, or if there is a plugin already ?

    Thanks in Advanced.

    Attachments

    1. keeper_100.jpg (12.9 KB, 0 downloads) 1 year old
    Posted 1 year ago #
  2. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    It's technically possible and at least one site already does this but it's not easy.

    The problem is attachments are post based, which means you have to write a bunch of code.

    So you are better off using software already made for what you are trying to do, unless you know how to code.

    Posted 1 year ago #
  3. enatom
    enatom

    junior member
    Joined: Aug '10
    Posts: 9

    offline

    Do you know the site that already does this, yeahs I know how to code, not a mastercoder but I know how to code PHP.

    Im guessing in the loop I'd have to match the topic ID and look for the attachment in the attachments table using mySQL .. so it shouln't be too hard too create a function. Except how would you write this function to be the most optimal as possible (in terms of the SQL query too)??

    Posted 1 year ago #
  4. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    You'd have to take the list of topics on the page, then query for the post_position=1 for that list, then check the attachments db table to see if any of those posts have attachments.

    I am assuming only the first posts has attachments. If more than the first post, well then it's even more complicated as you'd have to get all the post id's for all the topics on the page.

    The site that already does this is http://gallery.weddingbee.com/
    but they are a commercial site with professional coders.

    Posted 1 year ago #
  5. enatom
    enatom

    junior member
    Joined: Aug '10
    Posts: 9

    offline

    It'll be all the posts not just the first, that'll have the attachment thumbnail shown. It dont see why its hard in concept. Becuase you would just call one function in the loop. The function would be called get_thumbnail($postid) for instance. Which would query the db for the image... this would all be done during the topics loop.

    Or am I missing something ?

    another question: when entering this tag [ attachment = 2082 , 164 ], what do these numbers denote?

    Attachments

    1. q4nmh9sf1cdon.jpg (2.9 KB, 0 downloads) 1 year old
    Posted 1 year ago #
  6. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    You will need two queries then.

    One to get all the post ids for all the topics on the page.

    Another to query the attachments db table to see if any of those posts have attachments.

    You do not want to do the two queries for each topic shown on front page, one by one in the loop. Do not do that because you will have 100 queries on the front page then and it will kill your server. Build a string array from the two queries before the loop.

    Posted 1 year ago #
  7. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    The two numbers are the post id # and the attachment id #.

    The reason I use both is to prevent people from being silly and posting dozens of attachments just based on sequential attachment #.

    Posted 1 year ago #
  8. enatom
    enatom

    junior member
    Joined: Aug '10
    Posts: 9

    offline

    Doesn't bbPress have a function that gets the Post ID during the loop, (something like $this->post_id() or similar) so I could use that, instead of writing my own?

    How could I build a string array outside of the loop, wouldn't I need to know the articles (inside the loop) to get any query done.

    Can't the plugin be modified slightly to be able to show in a topic loop. I would assume it would mostly be changing a hook?

    Posted 1 year ago #
  9. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    I'm going to stop here because we aren't going to do 100 questions until I write the entire routine for you. You cannot use API routines to accomplish this, it needs custom code to work efficiently.

    Posted 1 year ago #
  10. enatom
    enatom

    junior member
    Joined: Aug '10
    Posts: 9

    offline

    yeah that makes sense. I was looking at writing it myself but trying to understand why this can't be done inside the loop. (the custom code). Becuase a string array outside the loop would need a loop anyway, to populate the array.. so isnt that being slightly redundant

    Posted 1 year ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

keep _ck_ coding >> donate $5 <<     Theme Switcher:
30 users online from in the past 30 minutes. 13 bots 17 guests
1,930 views today 8,540 yesterday 16,043 peak. Most at once 43 today 50 yesterday 131 peak. Visited today: Gunnar07, wigbuy123, iplaytheme, guava, skat95, landc01
2,288 posts in 394 topics over 66 months by 430 of 2,168 members. Latest: wigbuy123, JeffreyCasivant, summerfortun