Is there a way to make a template output an image after using thumb() or something like that, as opposed to outputting an html img tag?
On my site I have javascript which detects the size of the image that I want to retrieve based on the page layout and then uses a PHP library (SLIR) to do the re-sizing. The problem is, the re-sizing library seems to be slow so I want to try using Kirby’s system for re-sizing and caching images. Currently the javascript calls a PHP page where I do a bit more mathematics and then I include the re-sizing library. Now instead I am trying a redirect to a Kirby page.
I have tried creating a simple Kirby template like this:
<?php
$im = new Media('/portfolio/test.jpg', url() . '/portfolio/test.jpg') ;
echo thumb($im);
And then from my custom PHP script I say
header("Location: http://example.com/image-test")
and “/image-test” uses the simple template above. It works fine if I view the image on it’s own. But images do not load when they are embedded in a page. I know this has something to do with headers and content-type or whatever, but I am not sure what to do in this situation.