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

Display uploaded image automatically in a markdown post

I'm using vanilla 2.2.1 and the advanced editor, with markdown input.

Maybe I'm doing something wrong, but for me when i upload a image it's held as an attachment/file. It doesn't automatically add it's self to the post. Also, gifs are turned into static images it seems.

I've found out that if I put the link to the upload, after it' in the server, in the "img_url" for it to display(like any other file), it renders the image properly as expected.
But shouldn't it do all of that automatically by default, I mean it's kind of the expected result.
With the WYSIWYG editor it does that alright.
Any ideas on how to extend it to do so?
Does the new advanced editor in 2.3 have these features?
Also, it would be nice if gifs were able to keep their animating properties.

Thanks for any response.

Comments

  • hgtonighthgtonight ∞ · New Moderator

    This is the behavior I see on my test install (automatically inserting the image after upload with a markdown formatter). Do you have any errors on your JS console?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Yeah, and it's clear that it works here too. Not sure why it doesn't work for me...
    Thanks for responding.

  • RiverRiver MVP
    edited November 2016

    @Kiori said:

    Yeah, and it's clear that it works here too. Not sure why it doesn't work for me...
    Thanks for responding.

    Searching is your best friend. This has been answered in at least three or four discussions with several different solutions.

    YES. you are correct it is broken regarding inserting with markdown in 2.2.1

    Here is one fix.

    https://vanillaforums.org/discussion/comment/241846/#Comment_241846

    you can find several other fixes by searching for inserting image.

    It has been fixed in 2.3, but there are other things broken in vanilla 2.3rc1 as far as I can tell but no one has responded

    https://vanillaforums.org/discussion/comment/243890/#Comment_243890

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

    hgtonightKiori
  • Thanks, either '.BodyBox' or '#Form_Body' work as search parameters. I didn't find those, I honestly thought I had broken something so I guess I didn't look that hard.

    Copying form the other post:

    To fix the issue in vanilla 2.2.1, The easiest for you based on your questions and responses is

    change this line 1210 in plugins/editor/js/editor.js from

         var editorWidth = $(editor.textarea.element).width();
         to
         var editorWidth = $(this).find('.BodyBox').width();
    

    Thanks again.

  • @River
    Are you familiar with how to fix this issue "GIF upload rendering in Editor". I mentioned it in my original post. Clearly it's fixed in 2.3 but I wanted to patch it in now, though I haven't found any info on it. I have searched.

  • RiverRiver MVP
    edited November 2016

    @Kiori said:
    @River
    Are you familiar with how to fix this issue "GIF upload rendering in Editor". I mentioned it in my original post. Clearly it's fixed in 2.3 but I wanted to patch it in now, though I haven't found any info on it. I have searched.

    whats the problem?

    show a screenshot of the error if you can.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • Gifs become static images. I copied the above description form here:https://vanillaforums.org/discussion/32168/vanilla-2-3-beta
    But this is happening in my install also.
    Any uploaded gif looses it's animation. Been using imgur as a work around.

  • RiverRiver MVP
    edited November 2016

    @Kiori said Gifs become static images.

    I guessed that it worked out of the box, since I never tried it.

    I don't know if this will work. it was the old way to make animated gifs work for profile pics.

    $Configuration['Garden']['Thumbnail']['SaveGif'] = TRUE;

    you would probably need to prevent re-sizing of the animated gifs.

    you could also look at http://stackoverflow.com/questions/718491/resize-animated-gif-file-without-destroying-animation

    http://www.phpclasses.org/package/7353-PHP-Resize-animations-in-files-of-the-GIF-format.html

    otherwise you would need to study the upload routine that the editor calls in the master and the changes that may occur in the editor for the version that works with the master.

    I would need to research don't know off-hand.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • @River said:
    I don't know if this will work. it was the old way to make animated gifs work for profile pics.

    $Configuration['Garden']['Thumbnail']['SaveGif'] = TRUE;

    you would probably need to prevent re-sizing of the animated gifs.

    Yeah I guess it's more hardcoded, the above doesn't work. Now that you mentioned it, it would be awesome if gifs worked for profile pics. Maybe this is a feature that vanilla should add.

    Thanks for the feedback! :waving:

    RiverFraktar
Sign In or Register to comment.