0

I want to use CAKE PHP MEIO upload to generate thumbnails of 50 photos programmatically taking from a directory and not by uploading individually.

May Be by calling some meio upload library function.

$meio->crop('/path/to/image/')->saveTo('/path/to/target/dir/filename.jpg');

Is there any possible way to upload files like this.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Vinay Aggarwal
  • 1,565
  • 1
  • 10
  • 19

1 Answers1

1

ImageTool is great for this kind of thing.

Use a combination of cake's Folder and File utilities to open the directory, loop through the files and apply the necessary resizing.

e.g.:

$dir = new Folder('/path/to/my/images');
$files = $dir->find('.*\.jpg'); // find all jpg
foreach($files as $file) {
    $this->ImageTool->resize(...);
    // etc
}
Ross
  • 18,117
  • 7
  • 44
  • 64