Title: Filter for img html code
Last modified: October 8, 2020

---

# Filter for img html code

 *  Resolved [Grzegorz.Janoszka](https://wordpress.org/support/users/grzegorzjanoszka/)
 * (@grzegorzjanoszka)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/)
 * 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](https://wordpress.org/support/users/grzegorzjanoszka/)
 * (@grzegorzjanoszka)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13510865)
 * 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](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13546284)
 * [@grzegorzjanoszka](https://wordpress.org/support/users/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](https://wordpress.org/support/users/grzegorzjanoszka/)
 * (@grzegorzjanoszka)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13546722)
 * I am using go-avif ([https://github.com/Kagami/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](https://core.trac.wordpress.org/ticket/51417)
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13546938)
 * I see. You’re in way advanced territory vs what I know 🙂
 *  Thread Starter [Grzegorz.Janoszka](https://wordpress.org/support/users/grzegorzjanoszka/)
 * (@grzegorzjanoszka)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13547495)
 * 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](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13558951)
 * 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](https://wordpress.org/support/users/grzegorzjanoszka/)
 * (@grzegorzjanoszka)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13559057)
 * 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/](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/](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](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13559105)
 * 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/](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](https://wordpress.org/support/users/grzegorzjanoszka/)
 * (@grzegorzjanoszka)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13559352)
 * 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.

 * ![](https://ps.w.org/contextual-related-posts/assets/icon-256x256.png?rev=2985705)
 * [Contextual Related Posts](https://wordpress.org/plugins/contextual-related-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contextual-related-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contextual-related-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/contextual-related-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contextual-related-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contextual-related-posts/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Grzegorz.Janoszka](https://wordpress.org/support/users/grzegorzjanoszka/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/filter-for-img-html-code/#post-13559352)
 * Status: resolved