リビジョン | 309 (tree) |
---|---|
日時 | 2010-11-15 06:05:50 |
作者 | kmorimatsu |
Use table and admin_thumbnail classes for moved methods.
@@ -284,13 +284,13 @@ | ||
284 | 284 | media::check_if_changed($time); |
285 | 285 | // Check if the file is an image. |
286 | 286 | if (!preg_match('/\.([^\.]+)$/',self::$file,$m)) error::quit('Not an image.'); |
287 | - $mime=admin_media::mime($m[1]); | |
287 | + $mime=tables::mime($m[1]); | |
288 | 288 | if (substr($mime,0,6)!='image/') error::quit('Not an image.'); |
289 | 289 | // Get the image info |
290 | 290 | list($width,$height,$new_width,$new_height)=self::image_size(self::$real_file_path); |
291 | 291 | // Return the image to browser (use tumbnail if possible. |
292 | 292 | if ($width!=$new_width || $height!=$new_height) { |
293 | - $gd=admin_media::gd($full_path,$mime); | |
293 | + $gd=admin_thumbnail::gd($full_path,$mime); | |
294 | 294 | if ($gd) $file=$gd[2]['file']; |
295 | 295 | } |
296 | 296 | if (!isset($file)) $file=self::local_file_contents(_DIR_SKINS,self::$real_file_path); |
@@ -299,9 +299,9 @@ | ||
299 | 299 | static public function tag_thumbnail(&$data){ |
300 | 300 | $file=$data['name']; |
301 | 301 | // Check if the file is an image. |
302 | - if (!preg_match('/\.([^\.]+)$/',$file,$m)) return self::p('Not an image.'); | |
303 | - $mime=admin_media::mime($m[1]); | |
304 | - if (substr($mime,0,6)!='image/') return self::p('Not an image.'); | |
302 | + if (!preg_match('/\.([^\.]+)$/',$file,$m)) error::quit('Not an image.'); | |
303 | + $mime=tables::mime($m[1]); | |
304 | + if (substr($mime,0,6)!='image/') error::quit('Not an image.'); | |
305 | 305 | // Get the image info |
306 | 306 | list($width,$height,$new_width,$new_height)=self::image_size(self::to_realpath(self::$real_dir_path.$file)); |
307 | 307 | // Show the img tag |
@@ -320,12 +320,12 @@ | ||
320 | 320 | $width=$info[0]; |
321 | 321 | $height=$info[1]; |
322 | 322 | // Decide the new size. |
323 | - if ($width>$height && $width>_CONF_THUMBNAIL_SIZE) { | |
324 | - $new_width=intval(_CONF_THUMBNAIL_SIZE); | |
325 | - $new_height=intval($height * _CONF_THUMBNAIL_SIZE / $width); | |
326 | - } elseif ($height>$width && $height>_CONF_THUMBNAIL_SIZE) { | |
327 | - $new_width=intval($width * _CONF_THUMBNAIL_SIZE / $height); | |
328 | - $new_height=intval(_CONF_THUMBNAIL_SIZE); | |
323 | + if ($width>$height && $width>_CONF_THUMBNAIL_ADMIN_SIZE) { | |
324 | + $new_width=intval(_CONF_THUMBNAIL_ADMIN_SIZE); | |
325 | + $new_height=intval($height * _CONF_THUMBNAIL_ADMIN_SIZE / $width); | |
326 | + } elseif ($height>$width && $height>_CONF_THUMBNAIL_ADMIN_SIZE) { | |
327 | + $new_width=intval($width * _CONF_THUMBNAIL_ADMIN_SIZE / $height); | |
328 | + $new_height=intval(_CONF_THUMBNAIL_ADMIN_SIZE); | |
329 | 329 | } else { |
330 | 330 | $new_width=$width; |
331 | 331 | $new_height=$height; |
@@ -335,7 +335,7 @@ | ||
335 | 335 | static public function action_get_download(){ |
336 | 336 | $filename=self::$file; |
337 | 337 | preg_match('/([^\.]*)$/',$filename,$m); |
338 | - $mime=admin_media::mime($m[1]); | |
338 | + $mime=tables::mime($m[1]); | |
339 | 339 | header("Content-Type: $mime; name=\"$filename\""); |
340 | 340 | header("Content-disposition: attachment; filename=$filename"); |
341 | 341 | $full_path=self::local_file_exists(_DIR_SKINS,self::$real_file_path); |