Announcement

Collapse
No announcement yet.

Uploaded images not displaying inline

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Uploaded images not displaying inline

    Warning - This hack of core causes problems when you update to the next version of vBulletin. Use at your own risk.
    When you update to a new version of vBulletin all previous images that were run through this hack will no longer display - they are lost.
    If you find a fix for this please let us know.



    Trying to get images working in the body text.

    If I "Share Photos". The image is successfully attached to the bottom of my post.


    If I add an inline image that is uploaded elsewhere it displays fine:


    If I try to upload an image for inline display it looks fine until I Post this thread, then it looks like this:
    Click image for larger version

Name:	pictures-6.jpg
Views:	87
Size:	30.6 KB
ID:	3962373
    which is just the letter "a" linked to the image. I want the image to display like it does in the first one shown above.


    I assume this is a bug since it gives the same problem here as on my forum.

    Any known fixes?
    Last edited by ZechariahStover; Wed 24th Jul '13, 5:02pm.
    Testing image upload in signatures: http://www.vbulletin.com/forum/filed...ledataid=63483
    It looks like it may be working but we will not know until we save it.

  • #2
    Warning - This hack of core causes problems when you update to the next version of vBulletin. Use at your own risk.
    When you update to a new version of vBulletin all previous images that were run through this hack will no longer display - they are lost.
    If you find a fix for this please let us know.
    __________________________________________________________________________________________ __________________

    For anyone interested in this.

    I am currently running vB 5.0.0 storing the images in the file system

    The problem appears to be in:
    core/vb/wysiwyghtmlparser.php

    Specifically in the protected function handleWysiwygImg($img_url, $fullurl)

    On line 441 it uses preg_match to start determining whether the image attachment files are stored in the database or in the file system. It returns BB code for the files being stored in the database even though my files are stored in the file system.

    A tweak to the regex on line 441 fixes the problem for me. I set the anchor with the caret (^) at the beginning of the regex string.

    I changed it from this:
    PHP Code:
    if (preg_match('#filedata/fetch\?filedataid=(\d+)#si'$img_url$matches)) 
    To this:
    PHP Code:
    if (preg_match('#^filedata/fetch\?filedataid=(\d+)#si'$img_url$matches)) 

    This allows my users to upload images and display them inline (without the images turning into the dreaded "a link")

    Note: I have not checked this tweak on an install with the attachment files in the database.
    Last edited by ZechariahStover; Wed 24th Jul '13, 5:03pm.
    Testing image upload in signatures: http://www.vbulletin.com/forum/filed...ledataid=63483
    It looks like it may be working but we will not know until we save it.

    Comment


    • #3
      I was pulling my hair out for weeks trying to get various options for image upload to work. My client really wants the inline images. Your posted fix corrected my problem and I store the image in the database!

      THANK YOU, wish I could beer you!


      Last edited by Jeff Wells; Tue 30th Apr '13, 9:20pm.

      Comment


      • #4
        By the way - I am curious if you are confronted with the same challenge I am with your end user. Asking my end users to use the "toggle advanced editor" mode, upload ect. will not be an easy sell. The only thing that comes to mind for me is to customize the "post reply" interface by suppressing the "share photos" link and turning on the "advanced editor window" to eliminate a couple steps. I fear the "share photos" link will be misleading. Thoughts?

        Comment


        • #5
          I really wish this would email me when I subscribe to threads.

          I have not had to face your concern because the switch from SimplePress to vBulletin has made their lives so much easier. I certainly understand your thoughts though. That is a major enough change that I would probably wait to see what they do in the next releases of vB. Rumor has it that vB 5.0.2 will have a lot of updates in the posting interface so I really need to look into that.

          Wishing you the best.

          Z
          Testing image upload in signatures: http://www.vbulletin.com/forum/filed...ledataid=63483
          It looks like it may be working but we will not know until we save it.

          Comment


        • #6
          Since this is now vB 5.0.2 I will test this problem again.

          Here is an inline image hosted elsewhere:


          and here is and inline image uploaded to this site:
          I guess not. It just dims my screen like a lightbox is coming up, but nothing comes. I will try uploading in my next post
          Testing image upload in signatures: http://www.vbulletin.com/forum/filed...ledataid=63483
          It looks like it may be working but we will not know until we save it.

          Comment


          • #7
            So trying again to upload an image for inline display:
            Click image for larger version

Name:	pictures-15.jpg
Views:	58
Size:	69.7 KB
ID:	3973497

            Had to refresh the page to cancel the problem I was having in my last post but hopefully it will work now.
            Testing image upload in signatures: http://www.vbulletin.com/forum/filed...ledataid=63483
            It looks like it may be working but we will not know until we save it.

            Comment


            • ZechariahStover
              ZechariahStover commented
              Editing a comment
              No go. Now I have to test my old fix and see if it works on vB 5.0.2

          • #8
            great topic!
            we have been fighting with this and patiently waiting 5.0.3 hoping the fix is in there but sooner is better

            for now what i did was upload where it shows the attachment link, then if you go back in again as an edit delete the attachment link and click "insert image"...then it will display, but if you edit the post again, you have to keep switching it to the IMG tags...pretty annoying

            Comment


            • #9
              Originally posted by IggyP View Post
              for now what i did was upload where it shows the attachment link, then if you go back in again as an edit delete the attachment link and click "insert image"...then it will display, but if you edit the post again, you have to keep switching it to the IMG tags...pretty annoying
              Same story here...


              Comment


              • #10
                sweet, it totally works....finally got to testing it...big props for this one

                Comment


                • #11
                  Originally posted by ZechariahStover View Post
                  For anyone interested in this.

                  I am currently running vB 5.0.0 storing the images in the file system

                  The problem appears to be in:
                  core/vb/wysiwyghtmlparser.php

                  Specifically in the protected function handleWysiwygImg($img_url, $fullurl)

                  On line 441 it uses preg_match to start determining whether the image attachment files are stored in the database or in the file system. It returns BB code for the files being stored in the database even though my files are stored in the file system.

                  A tweak to the regex on line 441 fixes the problem for me. I set the anchor with the caret (^) at the beginning of the regex string.

                  I changed it from this:
                  PHP Code:
                  if (preg_match('#filedata/fetch\?filedataid=(\d+)#si'$img_url$matches)) 
                  To this:
                  PHP Code:
                  if (preg_match('#^filedata/fetch\?filedataid=(\d+)#si'$img_url$matches)) 

                  This allows my users to upload images and display them inline (without the images turning into the dreaded "a link")

                  Note: I have not checked this tweak on an install with the attachment files in the database.
                  I can confirm this is working in 5.0.2 but only for new posts. It will not fix old posts that were already made. Even clearing the cache or re-editing the post will not fix them.

                  Comment


                  • #12
                    Hey Zechariah!

                    Thanks so much for this fix! It works great!


                    One question still remains for me:

                    If people want to post an image, they will be more inclined to click the little camera icon, which only puts a thumbnail (even having thumbs disabled). Then when they click on the thumb they get a small window (not full size) - same as in the first post)

                    My questions are:

                    1) Does anyone know if the little camera icon can be setup to post inline images somehow?

                    If that is not possible:

                    1) Can the image that pops up after you click on the thumb be full size

                    2) or.. can we disable that button somehow?


                    Thanks :-)

                    Comment


                    • #13
                      1) No, not possible (at least not without custom coding)

                      Also there is no way to make the image full size after you click on it, but I hope this changes in the future, I have logged it as a bug.

                      You can disable the button for other usergroups (not Admins) by going to the Admin CP -> Usergroups -> Registered Users (or whatever group) -> Edit Usergroups -> Scroll down to Create Permissions -> Can create photo gallery -> No. Save.

                      The icon will be gone.

                      Comment


                      • #14
                        Thanks Joe. Removed the icon for now.


                        Comment


                        • #15
                          same problem here and dying trying, still can't get the image to show up.

                          http://forum.kamerapengintai.com/for...a-cctv#post126

                          Comment

                          Related Topics

                          Collapse

                          Working...
                          X