debug('post_id=' . $post_id); if (($image = YapbImage::getInstanceFromDb($post_id)) != null) { $log->debug('Found YAPB image'); // These are the parameters that can be used through this script // I do define this parameters here since i want full control // over all parameters given to the YapbImage->transform method $parameters = array(); $directMappings = array( 'w','h','wp','hp','wl','hl','ws','hs','f', 'q', 'sx','sy','sw','sh','zc','bc','bg','fltr', 'err', 'xto','ra','ar','sfn','aoe','far','iar','maxb' ); for ($i=0, $len=count($directMappings); $i<$len; $i++) { $key = $directMappings[$i]; if (isset($_GET[$key])) { $value = $_GET[$key]; // Let's cache this parameter // We need it later on if ($key == 'fltr') { // fltr is the only overloaded parameter // we append every single one for ($j=0, $jlen=count($value); $j<$jlen; $j++) { $log->debug('fltr[]=' . $value[$j]); array_push($parameters, 'fltr[]=' . filterRequestValue($value[$j])); } } else { $log->debug($key . '=' . $value); array_push($parameters, $key . '=' . filterRequestValue($value)); } } } // We start output buffering since we don't want to // expose phpThumb warnings and notices ob_start(); // This is the main part of this script: // The call to the YapbImage->transform method $success = $image->transform($parameters, $log); // We now discard the output buffer ob_end_clean(); } else { $log->warn('no image found for post_id ' . $post_id); } } else { $log->warn('parameter post_id has to be a number'); } } else { $log->warn('Give me at last a post_id parameter, man!'); } // Finally: Success dependant output if ($success == false) { // No success: Output of the errorLog cached by // the YapbLogger echo '
Please reload this url to see the image
'; } } ?>