Trying to output path for custom template for the Image block
Permalink
I'm playing round with the image block, trying to duplicate a custom template I built previously that allowed me to pass the path to backstretch to add a full screen background image to my page.
I can't seem to output the path using the variables that are already listed in the core image block and I can't find anywhere in the forums which outlines how to do this.
This is what I've stripped the core image code back to:
and this is what it renders:
Can anyone help me out and let me know what I need to call to be able to output the path without the html that wraps it.
I can't seem to output the path using the variables that are already listed in the core image block and I can't find anywhere in the forums which outlines how to do this.
This is what I've stripped the core image code back to:
and this is what it renders:
<script> $.backstretch("<img src="/concrete5.7.2.1/application/files/7414/2049/5444/nature-walk-resized.jpg" alt="nature-walk-resized.jpg" width="1000" height="667">"); </script>
Can anyone help me out and let me know what I need to call to be able to output the path without the html that wraps it.
Thanks a million for answering so quickly. I'll look at this again today
Hi it's probably too late now, but incase anyone else wants it... I have managed to extract just the path using:
$image = Core::make('html/image', array($f)); $imagePath = $image->getTag()->src;
Very helpful, thanks for posting.
There isn't a lot of documentation on image use in 5.7 yet.
In the meantime, you can use Core::make('helper/image') like 5.6's Loader::helper(‘image’). It has been removed from legacy -https://github.com/concrete5/concrete5-5.7.0/issues/1618... .
This allows you to use getThumbnail() and imagename->src.
Also, I am finishing a block that does this exact thing, but without JavaScript or jQuery dependency. It also supports full screen background images on older browsers (using JavaScript).
I imagine this free block will be ready in the marketplace in a week or two.