O
O
Otrivin2019-10-10 15:19:08
Drupal
Otrivin, 2019-10-10 15:19:08

How to intercept and change the path to the picture?

Hello!
I'm trying to attach webp to a site on Drupal 7. It is necessary that when rendering a field with an image, depending on browser support, a webp version of the image is displayed. Unfortunately, I did not find a ready-made module.
I solved the problem by redefining the template of a specific field, but the question arose: what if there are a whole bunch of such fields? Is it possible to unify this process?
Is it possible to hook into some hook to intercept and modify the given image link (add '.webp' to the end, for example '/sites/all/files/ picture.png.webp ')? In which direction to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
andead, 2019-10-10
@Otrivin

Override theme_image()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question