hi!
I need to use some library so I need to use img src tag instead just “<?= $image->url() ?>”.
but when I use img src… I can not use url()->resize option…
is there any way to use in here? :
thank you!
hi!
I need to use some library so I need to use img src tag instead just “<?= $image->url() ?>”.
but when I use img src… I can not use url()->resize option…
is there any way to use in here? :
thank you!
You don’t have to echo the image, you can put the image url in the src attribute.
But the important part here is not to call resize()
on the result of url()
(which is just a string), but on the image object:
<?php if ($image = $page->image()): ?>
<img src="<?= $image->url() ?>" alt="<?=$image->alt() ?>">
<?php endif; ?>
Instead of $image->url()
you can use $image->resize(500)->url()