<?php include 'library/debug.php'; include 'library/whirl.class.php'; // demo $options = array(); $options['term'] = 'zitrone'; $options['quantity'] = 10; // $options['blendMode'] = 'multiply'; // $options['blendOpacity'] = '100'; // $options['alphaBlendMode'] = 'normal'; $options['finalImageWidth'] = 500; $options['finalImageHeight'] = null; $options['finalImageSizing'] = 'default'; // $options['backgroundColor'] = 'transparent'; // $options['effectColorizeRgba'] = '0,255,0,1'; // $options['effectList'] = 'colorize'; $options['cacheDir'] = dirname(__FILE__) . '/cache'; $whirl = new Whirl($options); // $results = $whirl->getResults(); // de($results); $whirl->whirl(); $finalImage = $whirl->finalImage(); echo '<img src="cache/blend/' . $finalImage . '">';
$whirl->clearCache(); break; case 'fetch': $whirl = new Whirl($options); $results = $whirl->getResults(); if (!file_exists($whirl->cacheDir . '/fetched-results.json')) { touch($whirl->cacheDir . '/fetched-results.json'); } file_put_contents($whirl->cacheDir . '/fetched-results.json', json_encode($results)); break; case 'save': $whirl = new Whirl($options); $json = file_get_contents($whirl->cacheDir . '/fetched-results.json'); $fetchedResults = json_decode($json); $whirl->saveResults($fetchedResults); break; case 'resize': $whirl = new Whirl($options); $whirl->resizeResults(); break; case 'multiply': $whirl = new Whirl($options); $result = $whirl->multiplyResults(); break; case 'final': $whirl = new Whirl($options); $result = $whirl->finalImage(); echo $result; break; } }