Further, I have found the following with getimagesize:
function _wp_get_attachment_image_src( $attachment_id,
$size='thumbnail',
$icon = false ) {
// get a thumbnail or intermediate image if there is one
if ( $image = _image_downsize($attachment_id, $size) )
return $image;
if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
$icon_dir =
apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
$src_file = $icon_dir . '/' . basename($src);
@list($width, $height) = getimagesize($src_file);
}
if ( $src && $width && $height )
return array( $src, $width, $height );
return false;
}
and
function _image_downsize($id, $size = 'medium') {
if ( !wp_attachment_is_image($id) )
return false;
$img_url = wp_get_attachment_url($id);
$meta = wp_get_attachment_metadata($id);
$width = $height = 0;
// plugins can use this to provide resize services
if ( $out = apply_filters('_image_downsize', false, $id, $size) )
return $out;
// try for a new style intermediate size
if ( $intermediate = image_get_intermediate_size($id, $size) ) {
$img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
$width = $intermediate['width'];
$height = $intermediate['height'];
}
elseif ( $size == 'thumbnail' ) {
// fall back to the old thumbnail
$thumb_file = wp_get_attachment_thumb_file( $id ); // modified by Y2
if ( $info = getimagesize($thumb_file) ) { //
$img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
$width = $info[0];
$height = $info[1];
}
}
if ( !$width && !$height && isset($meta['width'], $meta['height']) ) {
// any other type: use the real image and constrain it
list( $width, $height ) =
image_constrain_size_for_editor( $meta['width'],
$meta['height'], $size );
}
if ( $img_url)
return array( $img_url, $width, $height );
return false;
}
There doesn’t seem to be any gaps, but I don’t know much about php, so I can’t figure out why it is displaying this error at the same time as working perfectly. Any help is really appreciated.
Charlette