/** * @expectedException \ysaroka\autothumb\exception\ProcessException * @expectedExceptionMessage "type" variable must contain only words and numbers. */ public function testProcessExceptionInvalidTypeName() { $this->variables['type'] = 'sma~ll'; $this->autoThumb->process($this->variables, false); }
<?php /** * Created: 2016-05-17 * @author Yauhen Saroka <*****@*****.**> */ require_once dirname(__FILE__) . '/vendor/autoload.php'; use ysaroka\autothumb\AutoThumb; $autothumb = new AutoThumb(require_once dirname(__FILE__) . '/autothumb.config.php'); $autothumb->process($_GET);
/** * @expectedException \ysaroka\autothumb\exception\ConfigurationException * @expectedExceptionMessageRegExp /Image file "watermark": .* for type "small" does not exist/i */ public function testSetConfigExceptionInvalidWatemarkPath() { $this->config['types'] = ['small' => ['watermark' => TEST_DIR . 'data/images/watermarks/invalid/path/watermark-invalid.png']]; $this->autoThumb->setConfig($this->config); }
<?php /** * Created: 2016-05-17 * @author Yauhen Saroka <*****@*****.**> */ require_once dirname(__FILE__) . '/vendor/autoload.php'; use ysaroka\autothumb\AutoThumb; $autothumb = new AutoThumb(require_once dirname(__FILE__) . '/autothumb.config.php'); if (isset($_GET['regenerate'])) { $autothumb->cleanThumbnails('images'); header('Location: /index.php'); exit; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Autohumb demo project</title> </head> <body> <a href="index.php?regenerate=1">Regenerate all thumbnails</a> <div style="text-align: center"> <div><img src="<?php echo $autothumb->getThumbnail('images/original-image-1024x768.jpg', 'small'); ?> " /> </div> <div>Thumbnail type "small".</div>