Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Show images and videos in excerpts

edited June 2011 in Vanilla 2.0 - 2.8
Hi, I was wondering if it's possible to preview also at least images, if not even videos embedded, in the discussion excerpt created by this plugin.

So that if a user posts a discussion with only an image and no text, on the frontpage it will be shown, and not only the title.

Is it possible or not? Thanks!
Tagged:

Comments

  • I also, am interested in this. BUMPITY BUMP. I was trying to do in the plguin discussionexerpt2. But I have never worked with databases before so I don't know how to get the information form the database.
  • So anyway, how I did it. was change this on line 188 of class.example.plugin.php
    echo Wrap(SliceString(strip_tags($Sender->EventArguments['Discussion']->Body),$TrimSize), 'div', array(
    to this
    echo Wrap(SliceString($Sender->EventArguments['Discussion']->Body,$TrimSize), 'div', array(

    I also altered the css file to center the image by adding
    div.ExampleDescription img { display: block; margin: 0 auto; max-width: 566px; max-height: 566px; }
    I added in the max widths and heights so no images get too big (you might have to change the numbers to your own forums correct sizes).

    To test this I simply added an image in through buttonbar and one through fileupload, remember that the length to trim the preview to includes that of the image tag.

    Didn't try embedding youtube video but should work.
  • Very helpful and it works great @clethrill. Thank you so much

  • This is exactly what I was looking for as well. Thank you @clethrill

  • Tried the method of @clethrill but it didn't work.. Does it only work with 2.1? Or am I overlooking something. Hope someone could help me out or point me at the right direction? Thank you!

  • Never mind. My bad!

    Mistook automatic embed with HTML..

Sign In or Register to comment.