Hi,
The functionality you are talking about has been removed from rtPanel as that adds to the page load. This concept was being used as WordPress did not have the featured image functionality before.
If you still want to previous functionality you can place the following code in your themes’ functions.php
.
add_filter('rtp_default_image_path','mytheme_generate_automatic_thumbnails');
function mytheme_generate_automatic_thumbnails(){
return mytheme_generate_thumbs();
}
function mytheme_generate_thumbs( $attach_id = null, $size = 'thumbnail', $the_id = '' ) {
/* $the_id should be set if called outside the loop else global $post */
if ( $the_id != '' ) {
$post = get_post( $the_id );
} else {
global $post;
}
/* If featured image is set return the required src */
if ( $attach_id ) {
$image_src = wp_get_attachment_image_src( $attach_id, $size );
return $image_src[0] ;
} elseif ( preg_match( '//is', $post->post_content, $match ) ) {
/* If the image is inserted into the post through media library
* Catch the attachment's id from the first img tag's wp-image class
*/
if ( preg_match( '/wp-image-([\d]*)/i', $match[0], $thumb_id ) ) {
$image_src = wp_get_attachment_image_src( $thumb_id[1] , $size );
// check if the id has parents for sanity (To check if the thumbnail id is proper)
$attachment_parents = get_post_ancestors( $thumb_id[1] );
// initialise the variable for further processing
$proceed = 0;
if( is_array( $attachment_parents ) ) {
foreach ( $attachment_parents as $parent ) {
if ( $parent == $post->ID ) {
$proceed = 1;
}
}
} elseif ( $attachment_parents == $post->ID ) {
$proceed = 1;
} else {
$proceed = 0;
}
/* if proceed = 0 then download the img src and update the post content accordingly */
if( @!$proceed ) {
$updated_post = array();
$updated_post['ID'] = $post->ID;
/* remove the misleading wp-image class from img tag and update the current post */
$updated_image_tag = str_replace( $thumb_id[0], '', $match[0] );
$updated_post['post_content'] = str_replace($match[0], $updated_image_tag, $post->post_content );
wp_update_post( $updated_post );
/* trying to manage the replace and creation of image incase wordpress doesn't fetch url */
$double_check_tag = $match[0];
unset($match[0]);
$match[0] = $updated_image_tag;
return rtp_create_external_thumb($match, $post, $size, $double_check_tag);
}
// if proceed = 1 then just return the img src
return $image_src[0];
} else {
// if the img src does not contain wp-image class then need to download and create thumb
return rtp_create_external_thumb($match, $post, $size);
}
}
}
I would recommend you to use the above code but start using the WordPress Featured Image functionality for the new posts you publish to reduce the page load times. Hence to old post thumbs would get rendered using the above logic and the new one using the WordPress featured image logic.