Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Thumbnail

edited March 2008 in Vanilla 1.0 Help
Hey, Is there an addon, or a way to allow the user to upload an image, the have the image displayed by the discussion listing? I've downloaded the attachment extension, but I'm so new to Vanilla, I had no idea how to mod it to show the thumbnail on the discussion(grid I think its called) page. Any help would be much appreciated. Thanks. :)

Comments

  • edited March 2008
    There is an addon that does this for categories called CategoryIcons. You will have to look at how it adds it to the category grid, and then modify it to do the same for discussions; then allow the user to upload the desired icon with the Attachments 2 addon. (This is an interesting idea btw.)

    You should move this into the "Addon Requests" category, because it will require a bit more than a little tweak to accomplish this. (It needs to be its own addon)
  • edited March 2008
    Ah sorry, didn't notice that category. I saw category Icons, and I'll have to mess around with it a bit. is there any documentation about how the whole system is setup? It looks quite different to anything I've ever used before. EDIT: Okay so I see the category extension just adds some CSS to each ID. I could do that for the discussion list, but how would I know which thumbnail to get? Thanks!
  • Are you fluent in php?

    Here's the documentation on creating addons. If you do get this figured out and working; be sure to upload it to the addon repository
  • I'm okay in PHP. I can make an image upload in normal PHP, so maybe I'll see what I can do. :) It actually shouldn't be that hard. Just add them to a database, then for each listing, get the one labeled with the corresponding ID from the database. I just don't know how to write it to match Vanilla. I'll have to check out that documentation.
  • Changed the category. :)
  • edited March 2008
    You could consider making it role/permission based (see the documentation for more info on that).

    You also may find that it conflicts with multi file upload (if you go the attachments addon route), so you may consider not using the attachments addon (do what works) but you should take a look at its code for ideas. (such as making it an admin option as to where the files are uploaded to; and storing the path to the thumbnails in the db; etc.)

    Also, since you're new to Vanilla, you probably don't know much about dictionary definitions and languages. Look at the documentation for info on that, and also look at some of the other (preferably the more recent ones) addons for examples.
  • Alright, I got something that will work. Not totally sure if it was the right way, but its fine for now. The only problem now is the Attachments Mod. I thought it made thumbnails, then links to the main image. But now its just resizing them to the specified size. Maybe it never made thumbnails. :/ If not, do you know how I could keep the original and make a thumbnail? Thanks.
  • It looks like only the old version of attachments uses thumbnails. I need thumbnails, but I also need the database of version 2. :/
  • Alright I think I got it. :) Thanks for all the help.
  • I don't think attachments ever did thumbnails?

    you could look at what AccountPictures does to resize images when they're uploaded. (why do you need to keep the original full-size image?)

    I think it does something with javascript. (may I suggest using mootools and the mootools addon instead of replicating the js [account pictures doesn't do this, but if you need to use any javascript in your addon, I would recommend doing it with one of the js library addons (mootools or jQuery), so that the same code isn't replicated in multiple addons])
  • edited March 2008
    Also, I saw this at some point. You should consider using it as well, for some nice beveled edges. (you could do this as a separate addon for all embedded images; and be sure to keep it from beveling other images that are outside of a comment [such as advertisements or banners])

    I'll put this in a separate addon request.

    EDIT: here it is.
This discussion has been closed.