responsive images
Permalink Browser Info Environment
Is it possible to use the responsive images?
I like the feature of using an generated thumbnail, but it behaves different.
I like the feature of using an generated thumbnail, but it behaves different.
Type: | Pre-Sale |
---|---|
Status: | Archived |
I guess thats what we want.
We have in our theme (proprietory "Elemental-Theme") an extendable image thumbnailing system, creating multiple thumbnails like "small" 740px, "medium" 940px and "large" 1140px.
How can we make use this with your rather fantastic block?
We have in our theme (proprietory "Elemental-Theme") an extendable image thumbnailing system, creating multiple thumbnails like "small" 740px, "medium" 940px and "large" 1140px.
How can we make use this with your rather fantastic block?
If you want to display images similar to "Content" block, you need to:
(replace "yourHandle" and "yourHandleRep" with handle that you are using)
1. Image field in "Basic Information" tab
Create block with image field:
Label: "Example image"
Handle: "yourHandle"
In view.php paste:
2. Image field in "Entries" tab
Create block with repeatable image field:
Label: "Example image"
Handle: "yourHandleRep"
In generated controller.php find prepareForViewImage() method and remove double slash from line below:
In view.php paste:
3. Also if you want to get url of specific thumbnail, you can do something like that:
Unfortunately to get width and height of those thumbnails, you need to manually check if it exists and use getimagesize() function.
(replace "yourHandle" and "yourHandleRep" with handle that you are using)
1. Image field in "Basic Information" tab
Create block with image field:
Label: "Example image"
Handle: "yourHandle"
In view.php paste:
2. Image field in "Entries" tab
Create block with repeatable image field:
Label: "Example image"
Handle: "yourHandleRep"
In generated controller.php find prepareForViewImage() method and remove double slash from line below:
// $entry[$fileIDFieldName.'_object'] = $fileObject
In view.php paste:
<?php if (!empty($entry['yourHandleRep_link'])): ?> <?php // Picture tag $entry['yourHandleRep_tag'] = \Concrete\Core\Support\Facade\Application::getFacadeApplication()->make('html/image', [$entry['yourHandleRep_object']])->getTag(); $entry['yourHandleRep_tag']->alt(h($entry['yourHandleRep_alt'])); echo $entry['yourHandleRep_tag']; ?> <?php endif; ?>
3. Also if you want to get url of specific thumbnail, you can do something like that:
Unfortunately to get width and height of those thumbnails, you need to manually check if it exists and use getimagesize() function.
Thank you so much about your extensive information.
Unfortunately I do not understand enough to modify PHP-files. I thought it was easy, but I understand that this a complicated yet powerful tool.
Our block pulls an original 800px image in an isotope grid. The small images should be used in the large viewport and a large image is pulled for xs screens – sort of opposite use than normal.
I have to get in touch with the developer of our block, - maybe they can take care of it and use your codes shown above.
We also have to get going, to populate our site which is due next week. I hope we can add a possible solution later, exchanging the view file.
"Thumbs" up for your work.
stef
Unfortunately I do not understand enough to modify PHP-files. I thought it was easy, but I understand that this a complicated yet powerful tool.
Our block pulls an original 800px image in an isotope grid. The small images should be used in the large viewport and a large image is pulled for xs screens – sort of opposite use than normal.
I have to get in touch with the developer of our block, - maybe they can take care of it and use your codes shown above.
We also have to get going, to populate our site which is due next week. I hope we can add a possible solution later, exchanging the view file.
"Thumbs" up for your work.
stef
what do you mean by using responsive images? You can make images responsive just by few line of css (and anyway it's usually implemented in most themes).
Or do you mean using concrete5 thumbnails system (/dashboard/system/files/thumbnails) ?