Thumbnail type in 5.8.0

Permalink
I'm trying to get thumbnail type by its handle.
In 5.7 i'm using like this:
$type = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle( 'my_type' );

But in v5.8 we have
\Concrete\Core\Entity\File\Image\Thumbnail\Type\Type

and there is no getByHandle function.

How can i get thumbnail type in 5.8 ?

vr5
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi vr5,

It looks like Concrete\Core\Entity\File\Image\Thumbnail\Type\Type is used to create a thumbnail type and Concrete\Core\File\Image\Thumbnail\Type\Type is used to work with an existing thumbnail type.

Create thumbnail type
https://github.com/concrete5/concrete5/blob/aaa8a8232ee9c89a4346a113...

Get thumbnail type
https://github.com/concrete5/concrete5/blob/aaa8a8232ee9c89a4346a113...
https://github.com/concrete5/concrete5/blob/aaa8a8232ee9c89a4346a113...
c5dragon replied on at Permalink Best Answer Reply
c5dragon
Came across this problem too.

This works: (v5.8)
$small = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle('small');
      if (!is_object($small)) {
          $type = new \Concrete\Core\Entity\File\Image\Thumbnail\Type\Type();
          $type->setName('Small');
          $type->setHandle('small');
          $type->setWidth(768);
          $type->save();
      }