Ejemplo n.º 1
0
 $data = Imager::scale($src, $w, $h, $crop, $top);
 if (!$data) {
     die('Resize Error');
 }
 if ($type == 'png') {
     $data = Imager::optipng($data, md5($src . $w . $h . $crop . $top));
     if (!$data) {
         die('Optipng Error');
     }
 }
 $br = infra_imager_browser();
 $name = preg_replace("/(.*\\/)*/", '', $isrc);
 if (!$name) {
     $name = Path::encode($isrc);
 }
 $name = Imager::toutf($name);
 if (!preg_match('/ff/', $br)) {
     $name = rawurlencode($name);
 }
 if (preg_match('/ie6/', $br)) {
     $name = preg_replace("/\\s/", '%20', $name);
 }
 if (!$type) {
     $type = 'image/jpeg';
 }
 $ans = array('name' => $name, 'type' => $type);
 //return $data;
 //}, $args, isset($_GET['re']));
 //)
 file_put_contents($cachesrc . '.data', $data);
 file_put_contents($cachesrc, Load::json_encode($ans));