I want to be able to generate 3 copies of an image when it is saved as a TV. The copies would be scaled for mobile, tablet, and desktop. Then they would each be saved to different paths similar to /mobile /tablet /desktop.
The method that I have found for doing this is to assign a target width and height property to the image TV. Then create an event listener that will listen for an image tv to be changed. Then it will create the copies of the image, zoom crop them, using phpThumb, to their different target resolutions and save them to their respective paths and then I would need to change the tv value just to the files name.
Is this a good method for this?
I have looked for extras that do this and haven’t found any.
You can play with this to fit your own preferred breakpoints depending on your project.
The <img> tag works as a fallback option if none of the source tags match - but it’s also where you specify other attributes like alt and class that will apply to whatever source matches the viewport.
I’m sure there are many other ways to achieve this sort of result - and it’d be interesting to hear how other people go about it.
Wow I have never seen this html tag before. I was just going to change the base href of the page to the different paths based off of the browser dimensions. This is a much cleaner and simpler solution.