How do thumbnails now work in 8.5.1?
Permalink
Hi there, I'm trying to develop my own custom Page List block.
I've downloaded the thumbnail_grid to use as a template.
The way I used to get Concrete5 to produce a thumbnail was:
$img = $page->getAttribute('thumbnail');
$thumb = $ih->getThumbnail($img, 100, 75, true);
<a href="<?=$url?>"><img src="<? echo $thumb->src ?>" width="<? echo $thumb->width ?>" height="<? echo $thumb->height ?>" alt="" /></a>
but I am rather confused with what I see in the thumbnail_grid code which is:
$thumbnail = $page->getAttribute('thumbnail');
<a href="<?php echo $url ?>" target="<?php echo $target ?>"><?php
$img = Core::make('html/image', array($thumbnail));
$tag = $img->getTag();
$tag->addClass('img-responsive');
echo $tag;
?>
I've tried fiddling with the css, but that only changes the thumbnail size proportionately...
If anyone can give me a pointer, I'd be most grateful
Thanks
I've downloaded the thumbnail_grid to use as a template.
The way I used to get Concrete5 to produce a thumbnail was:
$img = $page->getAttribute('thumbnail');
$thumb = $ih->getThumbnail($img, 100, 75, true);
<a href="<?=$url?>"><img src="<? echo $thumb->src ?>" width="<? echo $thumb->width ?>" height="<? echo $thumb->height ?>" alt="" /></a>
but I am rather confused with what I see in the thumbnail_grid code which is:
$thumbnail = $page->getAttribute('thumbnail');
<a href="<?php echo $url ?>" target="<?php echo $target ?>"><?php
$img = Core::make('html/image', array($thumbnail));
$tag = $img->getTag();
$tag->addClass('img-responsive');
echo $tag;
?>
I've tried fiddling with the css, but that only changes the thumbnail size proportionately...
If anyone can give me a pointer, I'd be most grateful
Thanks
Thanks mate. That's got it sorted!
Hello
i made this solution that works fine for me:
I don't know if it's possible to do this better but it works and load a small thumb in mobile devices or a desktop version.
i made this solution that works fine for me:
<?php Loader::library('/concrete/vendor/mobile_detect'); $app = \Concrete\Core\Support\Facade\Application::getFacadeApplication(); $md = new Mobile_Detect(); if ($md->isMobile()) { $co = $app->make('config');$co->set('my_site_view', 'mobile_image_handle'); } else{ $co = $app->make('config');$co->set('my_site_view', 'myDesktop_handle');} $co = $app->make('config'); $linky = $co->get('my_site_view'); $type = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle($linky); $thumb = $img->getThumbnailURL($type->getBaseVersion()); ?>
I don't know if it's possible to do this better but it works and load a small thumb in mobile devices or a desktop version.
I now have a custom thumbnail type called 'pagelist_item'
How do I apply my custom thumbnail into my pagelist block template?
All I can see in the template is:
$img = Core::make('html/image', array($thumbnail));
$tag = $img->getTag();
$tag->addClass('img-responsive');
echo $tag;
So where do I tell it which thumbnail I want it to use? Or am I missing something???