if (!$image->compose($wm_image, $x2, $y2, $wm->opacity)) { break; } } } } } } $wm_image->destroy(); $timing['watermark'] = time_step($step); } // no change required - redirect to source if (!$changes) { header("X-i: No change"); ierror($page['src_url'], 301); } if ($d_size[0] * $d_size[1] < $conf['derivatives_strip_metadata_threshold']) { // strip metadata for small images $image->strip(); } $image->set_compression_quality(ImageStdParams::$quality); $image->write($page['derivative_path']); $image->destroy(); @chmod($page['derivative_path'], 0644); $timing['save'] = time_step($step); send_derivative($expires); $timing['send'] = time_step($step); $timing['total'] = time_step($begin); if ($logger->severity() >= Logger::DEBUG) { $logger->debug('', 'i.php', array('src_path' => basename($page['src_path']), 'derivative_path' => basename($page['derivative_path']), 'o_size' => $o_size[0] . ' ' . $o_size[1] . ' ' . $o_size[0] * $o_size[1], 'd_size' => $d_size[0] . ' ' . $d_size[1] . ' ' . $d_size[0] * $d_size[1], 'mem_usage' => function_exists('memory_get_peak_usage') ? round(memory_get_peak_usage() / (1024 * 1024), 1) : '', 'timing' => $timing)); }