NSP News widget can't get image

Get help or discuss with other members about business Joomla! 3 and 2.5 template designed especially for your start-up projects on dedicated support forum.
GK User
Wed Feb 20, 2013 1:09 am
Hi,

I have trouble with the NSP widget which can't fetch my article's picture when I configure WP to upload it to another folder than /wp-content/uploads
Your code does'nt seem to use wp_upload_dir function around lines 910 in gavern/widgets.nsp.php

Regards,
Thomas
User avatar
Fresh Boarder

GK User
Wed Feb 20, 2013 3:09 pm
OK, I've got a partial fix that works for me: I removed some parts of the code in widgets.nsp.php around lines 910 and kept only this :
Code: Select all
       $image = wp_get_attachment_image_src( get_post_thumbnail_id( $art_ID ), 'single-post-thumbnail' );
       $image_path = $image[0];

       if($image_path != '') {

        $new_path = $image_path;
       
          $style = '';


Looking forward to other thoughts.
Regards,
Thomas.
User avatar
Fresh Boarder

GK User
Wed Feb 20, 2013 3:36 pm
And here is a better way to fix it (using the not deprecated wp_get_image_editor function :
Code: Select all
       $image = wp_get_attachment_image_src( get_post_thumbnail_id( $art_ID ), 'single-post-thumbnail' );
       $image_path = $image[0];

       if($image_path != '') {
        $new_image = wp_get_image_editor( $image_path );
         if ( ! is_wp_error( $new_image ) ) {
           $new_image->set_quality( 60 );
           $new_image->resize( $this->wdgt_config['article_image_w'], $this->wdgt_config['article_image_h'], true );
           $new_path = $new_image->generate_filename( $new_image->get_suffix() );
           $new_image->save( $new_path );
          }
        else {
$new_path = $image_path;
        }
          $style = '';


Hope someone can build on this!

Thomas.
User avatar
Fresh Boarder

GK User
Wed Feb 20, 2013 8:35 pm
Hi,

This problem is solved in Meet GavernWP 1.6: https://github.com/GavickPro/Meet-Gaver ... 79dfb6cdb8

and it will be implemented in next week also in our other themes :)
User avatar
Administrator

GK User
Wed Feb 20, 2013 11:30 pm
Ok, thanks a lot!
For some reason my git repo was not completely synced so I hadn't seen the commit.

However you're still using a deprecated WP function which is now replaced by the one I suggested in my earlier code... ;)

Regards (from sunny, snowy Jura mountains, France),
Thomas.
User avatar
Fresh Boarder

GK User
Thu Feb 21, 2013 9:39 am
Yes, I know about this deprecated function - it will be fixed in the Meet Gavern 1.7 or in Meet Gavern 1.6.1 :)
User avatar
Administrator


cron