Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Traits;
  4.  
  5. /**
  6.  * Trait Thumbnails
  7.  * @package App\Traits
  8.  */
  9. trait Thumbnails
  10. {
  11.     /**
  12.      * @desc Method for setting a thumbnail for use in GridFields.
  13.      * @note: Don't tell Stevie.
  14.      * @return string
  15.      */
  16.     protected function getCMSThumbnail()
  17.     {
  18.         if ($this->ImageID && $image = $this->Image()) {
  19.             if ($image->exists()) {
  20.                 return $image->Fill(60, 40);
  21.             }
  22.         }
  23.  
  24.         return '(none)';
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement