Skip to content
This repository was archived by the owner on Oct 26, 2026. It is now read-only.
This repository was archived by the owner on Oct 26, 2026. It is now read-only.

Files: Thumb not working with WEBP format #825

Closed as not planned
Closed as not planned

Description

@Siumauricio

Hi, I was testing to upload and resize WEBP images with the thumb property, the file upload is working fine, but the resize is not working I was checking the code probably this is the issue, it's just taking these formats and not WEBP.

var imageContentTypes = []string{"image/png", "image/jpg", "image/jpeg"}

if list.ExistInSlice(oAttrs.ContentType, imageContentTypes) {

Activity

  1. changed the title [-]Thumb not working with WEBP format[/-] [+]Files: Thumb not working with WEBP format[/+] on Oct 23, 2022
  2. ganigeorgiev commented on Oct 23, 2022

    @ganigeorgiev
    Member

    Unfortunately It's not just the file extension that is missing.

    Webp is not supported at the moment because the image library that we use, disintegration/imaging, doesn't support webp (mostly due to the lack of native go webp encoding - golang/go#45121; most webp go packages seems to rely on libwebp which requires cgo and I want to avoid that).

    There are workarounds, like decoding the uploaded image and converting it to jpg/png thumb, but for now this remains out of the scope for v1.0.

  3. KnockOutEZ commented on Apr 15, 2023

    @KnockOutEZ

    @ganigeorgiev can I look into this and try to solve this without cgo?

  4. ganigeorgiev commented on Apr 15, 2023

    @ganigeorgiev
    Member

    @KnockOutEZ I'm open for suggestions but please first outline some of your planned implementation details to avoid investing unnecessary time and efforts in something that may not get merged.

  5. Wikidepia commented on Jan 8, 2024

    @Wikidepia

    I stumbled upon this issue, just want to add that there are CGo-free webp encoder/decoder: https://git.sr.ht/~jackmordaunt/go-libwebp :)

  6. laszlo1337 commented on Mar 8, 2024

    @laszlo1337
  7. ganigeorgiev commented on Mar 8, 2024

    @ganigeorgiev
  8. aalokkamble commented on Mar 14, 2024

    @aalokkamble

    @ganigeorgiev, I have a suggestion regarding adding WebP support. We can still utilize the disintegration/imaging, library, but with a slight adjustment. We can incorporate another library to convert WebP images to JPEG format, then proceed with imaging to generate thumbnail blobs. Subsequently, we can use this webp library to convert the thumbnail blobs back to WebP format and save them.

    If you're okay with this approach, I'm ready to dive into the coding process!

  9. ganigeorgiev commented on Mar 14, 2024

    @ganigeorgiev
    Member

    @aalokkamble Feel free to create a POC implementation but I'm not interested on working on this for the moment.
    Note that your custom implementation doesn't necessary need to be part of the core repo and can be implemented to some extend as a "plugin"/library by attaching to the OnFileDownloadRequest hook (see example "plugins" in https://github.com/pocketbase/pocketbase/tree/master/plugins).

  10. ganigeorgiev commented on Nov 26, 2024

    @ganigeorgiev
    Member

    Old issues cleanup: I'm closing this because I'm not planning working on it. I've briefly checked the suggested https://git.sr.ht/~jackmordaunt/go-libwebp but it comes with too high maintanence/dependency cost I want to avoid it. The currently supported thumb image formats are listed in the documentation. If someone want to work on it, feel free to link your PoC and I may reconsider it.

  11. ganigeorgiev commented on Apr 20, 2025

    @ganigeorgiev
    Member

    Just for info: partial WebP thumbs support was enabled as part of #6744 (thumbs for now are stored as PNG).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions