Support » Plugin: Contextual Related Posts » Filter for img html code

  • Resolved Grzegorz.Janoszka

    (@grzegorzjanoszka)


    Hi,
    I am integrating avif images using picture tag. The only place on my website that doesn’t use avif images is CRP. Is there a filter for html img tag does I could use to inject picture tag around it?
    I have googled for a list of CRP filters but couldn’t easily find it.
    Thank you in advance for your answer.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    Huh, I had to spend almost an hour before I found crp_get_image_html and I am going to use it 🙂
    So I am closing this ticket in order not to bother the author 🙂

    Plugin Author Ajay

    (@ajay)

    @grzegorzjanoszka

    Sorry for the delay. Glad to know you found it. Am curious as to what code you’re using to add the avif support

    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    I am using go-avif (https://github.com/Kagami/go-avif/), but I am looking for something else as it is huge memory requirements – a 1MB JPG may take like 4-6 GB of RAM to convert.
    And around it my dirty code around some hooks. The only issue I have is the WP editor:
    https://core.trac.wordpress.org/ticket/51417

    Plugin Author Ajay

    (@ajay)

    I see. You’re in way advanced territory vs what I know 🙂

    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    Well, the JPG standard is in retreat. I have put on my website one test image with picture tag presenting three images – avif, webp and jpg fallback.
    The data for today:

    JPG: 177
    WEBP: 697
    AVIF: 213

    So old good JPG is the last. WEBP currently leads because of mobile Chrome (not everyone has updated yet) and Firefox which supports AVIF but it is disabled by default in the config.

    Most of images I have in AVIF and JPG and I graph their numbers. The average for last 36 hours is 27 JPG’s and 9 AVIF in a unit of time.
    When most mobile devices will have new Chrome and Firefox will enable AVIF by default then AVIF numbers should be higher than JPG. And files are at least 30% smaller.

    Plugin Author Ajay

    (@ajay)

    that’s pretty good. What are you using to generate the webp and avif’s? I’m quite reluctant to pay for solutions at least at this stage for my personal blogs.

    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    The webp’s are easy – php has a built-in function to deal with it. But I used the plugin media webp: https://wordpress.org/plugins/media-webp/
    It is old, not maintained and has one annoying bug, but it is very efficient.
    I however don’t create any webp files for new images, but I keep them for images added earlier.

    I do avif’s with go-avif (https://github.com/Kagami/go-avif/) – it is a CLI tool for Linux x64. The only issue is its huge RAM requirements.

    Plugin Author Ajay

    (@ajay)

    Thank you for this. I can see that avif is better which I understand as your approach.

    I noticed that https://wordpress.org/plugins/imagify/ is good for freely converting to webp and might give that a spin. My sites barely have any visitors so the performance optimisation might take me more time to do vs the slightly faster/incremental visitor count 🙂

    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    As far as I see that imagify sends your pictures somewhere to be optimized there. I don’t like it and all my plugins do local optimization. But well, if you don’t have shell access to the server then I guess it is easier.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Filter for img html code’ is closed to new replies.