/** * Turns the operations and their params into a string that can be used in a file name to cache an image. * * Suffix your image with the string generated by this method to be able to batch delete a file that has versions of it cached. * The intended usage of this is to store the files as my_horse.thumbnail+width-100-height+100.jpg for example. * * So after upload store your image meta data in a db, give the filename the id of the record and suffix it * with this string and store the string also in the db. In the views, if no further control over the image access is needd, * you can simply direct linke the image like $this->Html->image('/images/05/04/61/my_horse.thumbnail+width-100-height+100.jpg'); * * @param Model $Model * @param array $operations Imagine image operations * @param array $separators Optional * @param bool $hash * @return string Filename compatible String representation of the operations * @link http://support.microsoft.com/kb/177506 */ public function operationsToString(Model $Model, $operations, $separators = array(), $hash = false) { return \Imagine\ImagineUtility::operationsToString($operations, $separators, $hash); }
/** * testOperationsToString * * @return void */ public function testOperationsToString() { $operations = array('thumbnail' => array('width' => 200, 'height' => 150)); $result = \Imagine\ImagineUtility::operationsToString($operations); $this->assertEqual($result, '.thumbnail+width-200+height-150'); }