generate() public method

Insert Croppa parameter suffixes into a URL. For use as a helper in views when rendering image src attributes.
public generate ( string $url, integer $width = null, integer $height = null, array $options = null ) : string
$url string URL of an image that should be cropped
$width integer Target width
$height integer Target height
$options array Addtional Croppa options, passed as key/value pairs. Like array('resize')
return string The new path to your thumbnail
Example #1
0
 public function testSecure()
 {
     $url = new URL(['signing_key' => 'test']);
     $this->assertEquals('/path/file-200x100.png?token=dc0787d205f619a2b2df8554c960072e', $url->generate('/path/file.png', 200, 100));
     $url = new URL(['signing_key' => 'test']);
     $this->assertNotEquals('/path/file-200x100.png?token=dc0787d205f619a2b2df8554c960072e', $url->generate('/path/file.png', 200, 200));
 }