public function execute(Dm_Image $image) { $w = $this->width; $h = $this->height; $f = (int) $this->fram; $fit = new Dm_Image_Filter_Fit($w, $h, true); $crop = new Dm_Image_Filter_Crop($w, $h); $filters = array($fit, $crop); $image->applyFilters($filters); $effectImage = new Dm_Image_File(dirname(__FILE__) . '/img/instagram_effect_01.png'); $effectImage->applyFilters($filters); $image->draw($effectImage, 0, 0, $effectImage->getWidth(), $effectImage->getHeight()); $filteredResource = $image->getImageResource(); $this->effect($filteredResource); if ($f === 1 || $f === 2 || $f === 3) { $frameImage = new Dm_Image_File(dirname(__FILE__) . '/img/frame_' . str_pad($f, 2, '0', STR_PAD_LEFT) . '.png'); $frameImage->applyFilters($filters); $image->draw($frameImage, 0, 0, $frameImage->getWidth(), $frameImage->getHeight()); } $image->setImageResource($filteredResource); return $filteredResource; }
<img src="<?php echo $image2->toDataSchemeURI(); ?> " /><?php ?> <img src="../src/lib/DmImage/02.jpeg" style="width:300px;" /><?php $filter = new Dm_Image_Filter_InstagramLoFi(300, 3); $image3 = new Dm_Image_File('/home/www/demouth/www/docroot/git/dmpiechart/src/lib/DmImage/lena_std.png'); $image3->applyFilter($filter); ?> <br><img src="<?php echo $image3->toDataSchemeURI(); ?> " /><?php $filter2 = new Dm_Image_Filter_InstagramWalden(300, 0); $image4 = new Dm_Image_File('/home/www/demouth/www/docroot/git/dmpiechart/src/lib/DmImage/lena_std.png'); $image4->applyFilter($filter2); ?> <img src="<?php echo $image4->toDataSchemeURI(); ?> " /><?php ?> <img src="./src/lib/DmImage/lena_std.png" style="width:300px;" /><?php //$image->draw($image2,190,160); //$image->display(); exit; $color = DmColor::rgb(155, 200, 60); $color2 = DmColor::rgb(155, 200, 60); $color2->v($color2->v * 0.8); print $color2->hsv;
{ var_dump($errno, $errstr, $errfile, $errline); exit; } //------------------------------------ // サンプル //------------------------------------ $originalImagePath = './horse.jpeg'; $filter1 = new Dm_Image_Filter_InstagramLoFi(300, 1); $filter2 = new Dm_Image_Filter_InstagramWalden(300, 2); $filter3 = new Dm_Image_Filter_InstagramToaster(300); $image1 = new Dm_Image_File($originalImagePath); $image1->applyFilter($filter1); $image2 = new Dm_Image_File($originalImagePath); $image2->applyFilter($filter2); $image3 = new Dm_Image_File($originalImagePath); $image3->applyFilter($filter3); ?> <!DOCTYPE html> <head> <meta charset="UTF-8" /> </head> <body> <div> 元画像<br> <img src="<?php echo $originalImagePath; ?> "> </div> <div>
error_reporting(-1); set_error_handler('onError'); function onError($errno, $errstr, $errfile, $errline) { var_dump($errno, $errstr, $errfile, $errline); exit; } //------------------------------------ // サンプル //------------------------------------ $originalImagePath = './horse.jpeg'; $width = 200; $height = 200; $fitFilter = new Dm_Image_Filter_Fit($width, $height, true); $cropFilter = new Dm_Image_Filter_Crop($width, $height); $image = new Dm_Image_File($originalImagePath); $image->applyFilters(array($fitFilter, $cropFilter)); ?> <!DOCTYPE html> <head> <meta charset="UTF-8" /> </head> <body> <div> 元画像<br> <img src="<?php echo $originalImagePath; ?> "> </div> <div>
require_once $DmDirPath.'Dm/Image/Graphic/Shape.php'; require_once $DmDirPath.'Dm/Image/File.php'; require_once $DmDirPath.'Dm/Image/Filter/Abstract.php'; require_once $DmDirPath.'Dm/Image/Filter/Fit.php'; require_once $DmDirPath.'Dm/Image/Filter/Crop.php'; require_once $DmDirPath.'Dm/Image/Filter/InstagramNormal.php'; require_once $DmDirPath.'Dm/Image/Filter/InstagramLoFi.php'; require_once $DmDirPath.'Dm/Image/Filter/InstagramWalden.php'; require_once $DmDirPath.'Dm/Image/Filter/InstagramToaster.php'; */ //------------------------------------ // エラー出力(ここは必要に応じて) //------------------------------------ ini_set('display_errors', 'on'); error_reporting(-1); set_error_handler('onError'); function onError($errno, $errstr, $errfile, $errline) { var_dump($errno, $errstr, $errfile, $errline); exit; } //------------------------------------ // サンプル //------------------------------------ $filter = new Dm_Image_Filter_Fit(400, 400); $image = new Dm_Image_File(dirname(__FILE__) . '/horse.jpeg'); $image->applyFilter($filter); $logoImage = new Dm_Image_File(dirname(__FILE__) . '/php.gif'); $image->draw($logoImage, 20, 20); $image->display(); exit;