Example #1
0
 /**
  * Generate thumbnails based on the folders in the path
  * Use
  *  - 128x128 as folder name to generate an image that where the width will be 128px and the height will be 128px
  *  - 128x as folder name to generate an image that where the width will be 128px,
  *      the height will be calculated based on the aspect ratio.
  *  - x128 as folder name to generate an image that where the width will be 128px,
  *      the height will be calculated based on the aspect ratio.
  *
  * @param string $path
  * @param string $filename
  */
 public function generateThumbnails($path, $filename)
 {
     // create folder if needed
     $fs = new Filesystem();
     if (!$fs->exists($path . '/source')) {
         $fs->mkdir($path . '/source');
     }
     // move the source file
     $this->moveFile($path . '/source/' . $filename);
     // generate the thumbnails
     Model::generateThumbnails($path, $path . '/source/' . $filename);
 }