$aspectRatios = call_user_func($aspectRatioConstant); $negateAspectRatio = $aspectRatio[0] == '!' ? true : false; $aspectRatio = $negateAspectRatio ? substr($aspectRatio, 1) : $aspectRatio; if (isset($aspectRatios[$aspectRatio])) { $aspectRatio = $aspectRatios[$aspectRatio]; } if ($negateAspectRatio) { $aspectRatio = 1 / $aspectRatio; } is_null($aspectRatio) or is_numeric($aspectRatio) or errorPage('Aspect ratio out of range', 404); verbose("aspect ratio = {$aspectRatio}"); $cropToFit = getDefined(array('crop-to-fit', 'cf'), true, false); verbose("crop to fit = {$cropToFit}"); $backgroundColor = getConfig('background_color', null); if ($backgroundColor) { $img->setDefaultBackgroundColor($backgroundColor); verbose("Using default background_color = {$backgroundColor}"); } $bgColor = get(array('bgColor', 'bg-color', 'bgc'), null); verbose("bgColor = {$bgColor}"); $resizeStrategy = getDefined(array('no-resample'), true, false); if ($resizeStrategy) { $img->setCopyResizeStrategy($img::RESIZE); verbose("Setting = Resize instead of resample"); } $fillToFit = get(array('fill-to-fit', 'ff'), null); verbose("fill-to-fit = {$fillToFit}"); if ($fillToFit !== null) { if (!empty($fillToFit)) { $bgColor = $fillToFit; verbose("fillToFit changed bgColor to = {$bgColor}");