Modification thumbnail type for block
Permalink
Hello,
I would like to change the thumbnail type in the attribute page block.
Someone would have an idea of how should I go about it?
Thank you very much
I would like to change the thumbnail type in the attribute page block.
Someone would have an idea of how should I go about it?
Thank you very much
Thank you for this quick response.
Resize the image, I had an idea to do it but actually it was not that one, so it'll be able to help me.
On the other hand, I saw on the help :
https://documentation.concrete5.org/developers/working-with-files-an...
I can not find in the attribute page block, where I have to put it.
Resize the image, I had an idea to do it but actually it was not that one, so it'll be able to help me.
On the other hand, I saw on the help :
https://documentation.concrete5.org/developers/working-with-files-an...
I can not find in the attribute page block, where I have to put it.
the attribute page block is in concrete/blocks/page_attribute_display
But you should not modify it directly or you will lose your modifications next time you update Concrete5
But you should not modify it directly or you will lose your modifications next time you update Concrete5
But is not it possible to create a template on this block? to be able to use :
$type = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle('gallery');
foreach($images as $file) {
if (is_object($file)) {
$src = $file->getThumbnailURL($type->getBaseVersion());
echo '<div class="thumbnail">';
echo "<img src=\"$src\" alt=\"{$file->getTitle()}\" width=\"{$type->getWidth()}\" height=\"{$type->getHeight()}\">";
echo '</div>';
}
}
?
$type = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle('gallery');
foreach($images as $file) {
if (is_object($file)) {
$src = $file->getThumbnailURL($type->getBaseVersion());
echo '<div class="thumbnail">';
echo "<img src=\"$src\" alt=\"{$file->getTitle()}\" width=\"{$type->getWidth()}\" height=\"{$type->getHeight()}\">";
echo '</div>';
}
}
?
in the view, instead of
use
echo $controller->getContent();
use
$c = Page::getCurrentPage(); $content = $c->getAttribute($controller->attributeHandle); if (is_object($content) && ($content instanceof Concrete\Core\Entity\File\File || $content instanceof \Concrete\Core\Entity\File\File)) { $type = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle('gallery'); $src = $content->getThumbnailURL($type->getBaseVersion()); echo "<img src=\"{$src}\" width=\"{$type->getWidth()}\" height=\"{$type->getHeight()}\" alt=\"\" />"; } else { echo $controller->getContent(); }
Thank you very much is perfect.
Do you have an idea to do the same thing on the block slider image?
Thank you again for your response as fast and efficient.
Do you have an idea to do the same thing on the block slider image?
Thank you again for your response as fast and efficient.
In your template, before this piece of code
you can write this
Modify 450 for any value you want. You also don't have to use both values, you can use one and the other will fallback to its default value of 250.
By default, the resizing is proportional and doesn't crop the image. There is no simple way to change that. There is a way, it's just not simple.