function get_pic($src, $size = 0, $thumb = 0) { if (empty($src)) { return array(); } $data = array('src' => $src, 'url' => iFS::fp($src, '+http')); if ($size) { $data['width'] = $size['w']; $data['height'] = $size['h']; } if ($size && $thumb) { $data += bitscale(array("tw" => (int) $thumb['width'], "th" => (int) $thumb['height'], "w" => (int) $size['w'], "h" => (int) $size['h'])); } return $data; }
} } if (fsexists($src)) { $image = new Gmagick(); $image->readImage($src); $scale = array("tw" => $tw, "th" => $th, "w" => $image->getImageWidth(), "h" => $image->getImageHeight()); if ($tw > 0 && $th > 0) { $im = scale($scale); $image->resizeImage($im['w'], $im['h'], null, 1); $x = $y = 0; $im['w'] > $im['tw'] && ($x = ceil(($im['w'] - $im['tw']) / 3)); $im['h'] > $im['th'] && ($y = ceil(($im['h'] - $im['th']) / 3)); $image->cropImage($tw, $th, $x, $y); } else { empty($scale['th']) && ($scale['th'] = 9999999); $im = bitscale($scale); $image->resizeImage($im['w'], $im['h'], null, 1); } $expires = 31536000; header("Cache-Control: maxage=" . $expires); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_SERVER['REQUEST_TIME']) . ' GMT'); header('Expires: ' . gmdate('D, d M Y H:i:s', $_SERVER['REQUEST_TIME'] + $expires) . ' GMT'); $srcData = $image->current(); } else { //1x1.gif $srcData = 'R0lGODlhAQABAIAAAAAAAP///yH5BAEHAAEALAAAAAABAAEAAAICTAEAOw=='; //nopic.gif $srcData = 'R0lGODlhyADIAKIAAMzMzP///+bm5vb29tXV1d3d3e7u7gAAACH5BAAHAP8ALAAAAADIAMgAAAP/ SLrc/jDKSau9OOs9g/9gKI5kaZ5oqq5s676kAs90bd94bsp67//AoIonLBqPSBYxyWw6g8undEpVEqrYrBYU3Xq/ xy54TM6Jy+h066xuu0fst9wdn9vL9bvem9/7q31/gk6Bg4ZhV4eKVIWLjjqNj5I1kZOWLpWXmimZm54xiZ+iM52j o6Wmn6ipm6usl66vk7Gyj7S1i7e4h7q7g72+f8DBe8PEd8bHc8nKb8zNbc/QadLTeKHWp9jZqtvcrd7fsOHis+Tl