• Can you add webp as valid attachment file type?

    • This topic has 22 replies, 4 voices, and was last updated 2 years ago.
    Author
    Topic
    #2555228

    I convert webp to png before attaching files.

    Viewing 11 reply threads
    Author
    Replies
    • #2555262

      Try it now?

      Susan Bradley Patch Lady/Prudent patcher

      1 user thanked author for this post.
      • #2555333

        .webp has been uploaded as .jpg or did I made a mistake?

    • #2555403

      I’ve found that a lot of times when you select “save as” for a webp image on a web page it actually gets saved as a jpg image because it’s not really a webp image but simply a jpg image that’s had it’s extension changed from .jpg to .webp.

      Also, I attached a true webp image to my post and, if you look below at the Test-image-scaled.webp attachment, you’ll notice it doesn’t display as an actually viewable image but as a “link” to the attached file that you have to click on in order to see it.

      On the other hand…

      If you copy/paste the “image link” to a webp image from a web page directly into your post…

      It displays as expected (FYI, this is the same image I saved and attached below.)

      This means our forum software doesn’t support directly displaying attached webp files as actual images (most likely due to the “mime-type” the forum software assigns it) so, if you want your images to be visible “in your posts“, you’ll either have to copy/paste the actual “image link” from whatever web page it’s on into your post or, if it’s from your “local PC“, continue to convert them into an image format that our software can display.

      BTW, the “metadata header‘ for the image you attached shows it’s a JFIF type image where it would be WEBPVP8 if it was a webp image.

      For Susan,

      If it’s possible to set the specific mime-type for attachments, changing .webp to image/webp might allow webp attachments to display as images here on Askwoody.

      1 user thanked author for this post.
      • #2555486
        • #2555544

          @alex5723

          Your webp isn’t appearing as an image because you “attached” it to your post and, since our Askwoody S/W isn’t assigning it an image mine-type, the “Askwoody link” you attempted to use to display it still treats it as a non-image. In order for a webp to actually appear as an image, it must be assigned an image mime-type.

          That means for the copy/paste trick to work, it needs to be displayed as an image on whatever web site you copy the link from, like the webp image I pasted into my above post, so that Askwoody “knows” it’s an image and not just a link to a file.

          I know it’s a complicated problem but, unless it’s possible for Susan to change the mime-type Askwoody assigns to webp images, the only solution to posting a webp located on your PC will be either upload it somewhere else on the web where it is displayed as an image and then copy/paste the link to it into your post or convert it into a format that Askwoody does treat as an image.

          1 user thanked author for this post.
    • #2555659

      Your webp isn’t appearing as an image because you “attached” it to your post and, since our Askwoody S/W isn’t assigning it an image mine-type

      I am asking to add webp as a image mine-type.

    • #2555684

      Don’t know if you’ve noticed but, unlike a lot of other forum sites, there is no “insert an image” option in the Askwoody forum toolbar. That’s because it automatically recognizes whether a link you copy/paste into a post is an image or not (that whole mime-type thing again) but the catch is, the mime-type info comes from the server where the link is located and not whether the link ends in .jpg, .png, .gif, .bmp or webp.

      However, it’s possible to force an image link to be displayed as an image by using the following bbcode tags.

      Code:
       [img]link to some image[/img] 

      Note: this trick only works if the link actually is an image! If it’s not, it’ll appear like this.

      Note: this is what the above img tags look like if entered without the special code tags to keep the S/W from using the bbcode.

      So the webp image you attached above can be displayed as an image in a post here on Askwoody using those tags like this.

      Until such time as Susan determines if it’s possible to change the mime-type being assigned to webp attachments to the proper image/webp, this workaround will allow you to display attached webp images in your posts.

      Just FYI, because they’re stored online at a site where, even though they’re .gif images, they don’t get assigned an image mime-type, I use this same workaround to insert the special “animated smilies” I occasionally use in some of my posts like this one or the one I used in an above post.

      BTW, is there some special reason you only attach your images without also using the insert into content option?

      I ask because, unless a viewer is actually logged in, they can’t “see” attached images but, regardless of logged in status, everyone can “see” image attachments that have been inserted into the content.

      1 user thanked author for this post.
      • #2559414

        I’ll have to investigate.  I enabled the option to upload, I don’t control how the software handles it from there 🙂

        Susan Bradley Patch Lady/Prudent patcher

    • #2559435

      Susan,

      You’ll need to add the Allow webp file Upload plugin to WordPress so attached webp images get assigned the proper mime type.

      • #2559436

        So what does that plug in actually do?  Let me investigate first as I thought what I already had on the site allowed the files.

        Susan Bradley Patch Lady/Prudent patcher

        1 user thanked author for this post.
        • #2559538

          I downloaded the plugin and unzipped it.

          Here’s the code:

          Code:
          <?php
          /**
          * Plugin Name: Allow webp file upload
          * Plugin URI: https://wordtune.me
          * Description: Install an avtivate this Plugin enable uploading webp files
          * Author: WordTune
          * Author URI: https://wordtune.me
          * Version: 1.0
          * License: GPL-2.0+
          * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
          **/
          
          add_filter( 'upload_mimes', 'allowwebpupload', 1, 1 );
          function allowwebpupload ( $mime_types ) {
          $mime_types['webp'] = 'image/webp';
          
          return $mime_types;
          }
          ?>

          It appears all it does is add the proper webp mime type (image/webp) to the allowed uploads list; which “seems” to be why they don’t display when attached to a post.

          • #2559545

            But the code I have on the site does that already.

            Susan Bradley Patch Lady/Prudent patcher

    • #2559473

      Testing

      2.sm_

      Susan Bradley Patch Lady/Prudent patcher

    • #2559476
      • #2559477

        Natively wordpress supports webp since v 5.8.  I just have to figure out what other plug in is doing what.

        Susan Bradley Patch Lady/Prudent patcher

    • #2559480

      Testing again

      test

      Susan Bradley Patch Lady/Prudent patcher

      1 user thanked author for this post.
    • #2559554

      test-1

      Test

      Susan Bradley Patch Lady/Prudent patcher

    • #2559559

      test
      Test

      Susan Bradley Patch Lady/Prudent patcher

      • #2559561

        BTW the plug in on the site does nothing.  There is something in the bbpress toolbox that may be blocking this.  I’ll reach out to Milan but bottom line, merely adding the plug in doesn’t fix.

        Susan Bradley Patch Lady/Prudent patcher

        1 user thanked author for this post.
    • #2559677

      There is something in the bbpress toolbox that may be blocking this.

      They’re not actually being blocked, the forum is accepting .webp as a valid attachment.

      The problem is they’re being treated as a file attachment instead of an image attachment.

      According to what I found at How to Add Additional File Types to Be Uploaded in WordPress, if you look at Settings » File Upload Types it’ll display exactly what mime type has been assigned for the .webp extension.

      If it’s not image/webp, it needs to be changed.

      1 user thanked author for this post.
      • #2559734

        That’s what I have is that plug in.  Trust me I have researched this and know the settings and they are there, the problem is that it’s too new. From Milan:

        “WEBP is still not recognized as an image, and that is coming in the next plugin version (GD bbPress Toolbox Pro 7.1, in about 2 weeks). The problem was that WordPress gained full support for WEBP only recently with WP 6.1.”

        Besides I thought we didn’t like following what Google does?

         

         

        Susan Bradley Patch Lady/Prudent patcher

        1 user thanked author for this post.
    • #2559759

      Besides I thought we didn’t like following what Google does?

      Personally, I agree with that sentiment and that’s likely why it’s not really a common image format on most websites.

      As for me, except for the animated .gifs I sometimes use in my posts, I always use the .png format when I attach images.

      If I need to download a webp image from the web for some reason, I use ImageMagick to convert it into a 24 bit png .

    Viewing 11 reply threads
    Reply To: Can you add webp as valid attachment file type?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: