我创建了一个用于调整 WordPress 图像大小的函数
http://www.hashbangcode.com/blog/create-images-thumbnails-and-cache-them-php-287.html
但我收到此错误:
Fatal error: Cannot redeclare class image_resize
但我以前没有叫过这个类。
这是我的功能
function resize_image($thumb_id){
//check for thumbnail cache if not then create it
$attachment = wp_get_attachment_image_src($thumb_id, 'large');
$image_url = pathinfo($attachment[0]);
if (file_exists(get_template_directory().'/images/thumbs/' . $image_url['basename'])) {
// 2592000 = 30 days
if ( time() - filemtime(get_template_directory().'/images/thumbs/'.$image_url['basename']) > 2592000 ) {
unlink(get_template_directory().'/images/thumbs/'.$image_url['basename']);
}
}
if (!file_exists(get_template_directory().'/images/thumbs/' . $image_url['basename'])) {
include(get_template_directory().'/inc/image_resize.php');
// if cache file does not exist then create it.
$originalImage = new imageResize($attachment[0]);
$originalImage->size_width(120);
$originalImage->save(get_template_directory().'/images/thumbs/'.$image_url['basename']);
}
}
请告诉我它有什么问题??