Skip to content
Robert Reinhard edited this page Sep 18, 2015 · 5 revisions

Src and crops together

  • Source files in /www/public/uploads/
  • Crops should be created in /www/public/uploads/

Config

'src_dir'   => public_path().'/uploads',
'crops_dir' => public_path().'/uploads',
'path'      => 'uploads/(.*)$',

Usage

Croppa::url('/uploads/01/02/file.jpg', 200, 100); 
// returns /uploads/01/02/file-200x100.jpg
// crop created at `/www/public/uploads/01/02/file-200x100.jpg`

Crops in a sub-directory

  • Source files in /www/public/images/
  • Crops should be created in /www/public/images/thumbs/

Config

'src_dir'    => public_path().'/images',
'crops_dir'  => public_path().'/images/thumbs',
'path'       => 'images/(?:thumbs/)?(.*)$',
'url_prefix' => '/images/thumbs/',

Usage

Croppa::url('/images/file.jpg', 200, 100); 
// returns /images/thumbs/file-200x100.jpg
// crop created at `/www/public/images/thumbs/file-200x100.jpg`

Src outside of doc root

  • Source files in /www/storage/app/
  • Crops should be created in /www/public/images/thumbs/

Config

'src_dir'   => storage_path().'/app/images',
'crops_dir' => public_path().'/images',
'path'      => 'images/(.*)$',

Usage

Croppa::url('/images/file.jpg', 200, 100); 
// returns /images/file-200x100.jpg
// crop created at `/www/public/images/file-200x100.jpg`
Clone this wiki locally