stripos() error

January 2013 WordPress Theme
GK User
Fri May 31, 2013 12:35 pm
Hi all,

I'm running wordpress 3.5.1 with the gavickpro news theme on apache server running on a windows box. My problem is, the sites (both newly created and theme demo) throws the following errors and does not display the images & texts.

NewsFlash section
Warning: stripos() expects parameter 1 to be string, object given in C:\websites\Wordpress\wp-content\themes\News\gavern\widgets.slideshow.php on line 446

Warning: substr() expects parameter 1 to be string, object given in C:\websites\Wordpress\wp-content\themes\News\gavern\widgets.slideshow.php on line 447

also i have a similar problem in the posts :

An error occured during creating the thumbnail.


how can I fix this ?

best,

GB
User avatar
Fresh Boarder

GK User
Sun Jun 02, 2013 11:19 pm
Hi,

Are you using the newest version of the News Theme? Did you checked the cache directory permissions?
User avatar
Administrator

GK User
Tue Jun 04, 2013 11:23 am
Hi dziudek,

Yes, using the latest version of the news theme. Also copied the same files to an ubuntu box and runs fine. I think there's something with / and \ path delimiters. how can I set the path delimiter to be "\" on a windows box ?

best,

Onder


dziudek wrote:Hi,

Are you using the newest version of the News Theme? Did you checked the cache directory permissions?
User avatar
Fresh Boarder

GK User
Wed Jun 05, 2013 10:05 am
Please try to open file gavern/widgets.nsp.php and change function generate_art_image to:

Code: Select all
function generate_art_image($i) {
       $art_ID = '';

       if($this->wdgt_config['data_source_type'] == 'custom') {
          $art_ID = $this->wdgt_results[0][$i]->ID;
       } else {
          $art_ID = $this->wdgt_results[$i]->ID;
       }

       $art_url = get_permalink($art_ID);

       $image = wp_get_attachment_image_src( get_post_thumbnail_id( $art_ID ), 'single-post-thumbnail' );
       $image_path = $image[0];
       $upload_dir = wp_upload_dir();
       $image_path = str_replace($upload_dir['baseurl'] . '\', '', $image_path);

       if($image_path != '') {
          $img_editor = wp_get_image_editor( $upload_dir['basedir'] . '\' . $image_path);

          if(!is_wp_error($img_editor)) {
             $img_editor->resize($this->wdgt_config['article_image_w'], $this->wdgt_config['article_image_h'], true);
             $img_filename = $img_editor->generate_filename( $this->id, dirname(__FILE__) . '\' . 'cache_nsp');
             $img_editor->save($img_filename);

             $new_path = basename($img_filename); 
             $cache_uri = get_stylesheet_directory_uri() . '\gavern\cache_nsp\';

             if(is_string($new_path)) {
                $new_path = $cache_uri . $new_path;

                $style = '';

                if($this->wdgt_config['image_block_padding'] != '' && $this->wdgt_config['image_block_padding'] != '0') {
                   $style = ' style="margin: '.$this->wdgt_config['image_block_padding'].';"';
                }

                if($this->wdgt_config['article_image_pos'] == 'left' && $this->wdgt_config['article_image_order'] == 1) {
                   return apply_filters('gk_nsp_art_image', '<div class="gk-nsp-image-wrap"><a href="'.$art_url.'" class="gk-image-link"><img src="'.$new_path.'" alt="" class="gk-nsp-image" '.$style.' /></a></div>');
                } else {
                   return apply_filters('gk_nsp_art_image', '<a href="'.$art_url.'" class="gk-responsive gk-image-link" '.$style.'><img src="'.$new_path.'" alt="" class="gk-nsp-image gk-responsive" /></a>');
                }
             } else {
                return __('An error occured during creating the thumbnail.', GKTPLNAME);
             }
          } else {
             return __('An error occured during creating the thumbnail.', GKTPLNAME);
          }
       } else {
          return '';
       }
    }


then please resave (in order to clear the cache) some GK NSP widget with images to check if the thumbnails are propertly generated.
User avatar
Administrator


cron