add_filter to get_image

Posted in: Newspaper
Post count: 4

Hi, can I add a filter to the funcion get_image?

Here is also the code: https://drive.google.com/open?id=0B2fsiVeXE-iqRmFrRlAxVTJUNFU
For example:


add_filter('get_image', 'default_image_fallback', 10, 2);
function default_image_fallback($buffy, $thumbType) {
//http://pappmaskin.no/2010/03/how-to-make-the-wordpress-plugin-get_the_image-work-with-timthumb/
if( $thumbType == 'td_324x160' && function_exists( 'catch_that_image' ) )
         {
$buffy = '<img src="http://eju.tv/scripts/timthumb.php?w=324&h=160&zc=0&a=t&q=80&src='. str_replace(get_bloginfo('url'),'',catch_that_image()).'" alt="'.the_title_attribute('echo=0').'" width="324" height="160px" />';
//$output = '<img src="'.catch_that_image().'" alt="'. the_title_attribute('echo=0').'" width="336px" height="168px" />';
        }

		return $buffy;
}
Post count: 20688

Hi,

You could try entering the filter code for the images in the theme’s functions.php file. Or in the child theme functions file, if a child theme is used.
If you could provide more details about what exactly you are trying to do, maybe we can help you further.

Thanks

Post count: 4

Hi,

Ty for your reply. We are trying to resolve the problem of not having thumbnails for some posts. We have about 330.000 posts and this is a big number to use plugins like regenerate thumbnails.

We are using now a filter for the genesis theme (see here)

We find the first with function catch_that_image() and next we use function default_image_fallback($output, $args)

Our site is eju.tv
Test site prueba.eju.tv

And we want to do the same for Newspaper Theme. Can you help us with a filter code when there is no post thumb
is_null($this->post_thumb_id)

Kind regards

Post count: 20688

Hi,

You could try a plugin maybe that can automatically take the first image found in a post, and set it as featured image. Some users have tried in similar situations the Auto Post Thumbnail plugin.
The modules of the theme use the thumbnails created when the featured image is set for the post
https://www.screencast.com/t/8u6A2HtwQKX
This function is defined here
https://www.screencast.com/t/FjO3tQGgYLk8
And the thumbnail sizes here
https://www.screencast.com/t/uOwnFjgwN

Thanks

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.