Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Questions
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #21  
Old October 17th, 2013, 03:17 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Quote:
Originally Posted by froogly View Post
Hi Eric thank you for the prompt response, I think that might be the case, is there a way to filter stores, based on remote download capabilities?
No, unfortunately, this is not possible.
  #22  
Old February 18th, 2014, 06:15 PM
adamo8888 adamo8888 is offline
 
Join Date: Feb 2014
Posts: 4
Default still no featured image

Hi,

I did the code modification as set out to allow the theme to get the product image and store it in the library, however I don't get a picture, the media file thinks it is attached and the images seem to be downloading to the media library, just not displaying as featured images.

Store ID: 44403
Website URL: http://ucompare.me.uk/news/
  #23  
Old February 18th, 2014, 06:39 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

It is working... However the images are set to display 1px by 1px. You can even see them:



And here's the code:

HTML Code:
<img width="1" height="1" src="http://ucompare.me.uk/wp-content/uploads/2014/02/samsung-galaxy-s4-white-frost-2615.jpg" class="attachment-150x100 wp-post-image" alt="Samsung Galaxy S4 White Frost">

<img width="1" height="1" src="http://ucompare.me.uk/wp-content/uploads/2014/02/doc-johnson-ivibe-rabbit-thruster-vibrator-2613.jpg" class="attachment-150x100 wp-post-image" alt="Doc Johnson iVibe Rabbit Thruster Vibrator">
You need to change your theme settings to make the image larger.

Eric
  #24  
Old February 18th, 2014, 07:48 PM
adamo8888 adamo8888 is offline
 
Join Date: Feb 2014
Posts: 4
Default

Thanks Eric,
just added
width: 150px; height: 125px;
to the end of this
#middlecontent .excerptlist .articleexcerpt img{ float:left; margin:0 15px 5px 0; }

to make

#middlecontent .excerptlist .articleexcerpt img{ float:left; margin:0 15px 5px 0; width: 150px; height: 125px;}
  #25  
Old March 26th, 2014, 11:01 AM
mrdaniel mrdaniel is offline
 
Join Date: Mar 2014
Posts: 3
Default

Quote:
Originally Posted by Eric View Post
Hi

It is working... However the images are set to display 1px by 1px. You can even see them:

You need to change your theme settings to make the image larger.

Eric
The problem is probably not with the theme but the meta info of the pictures, the script lacks the important part where _wp_attachment_metadata is updated and different sizes of thumbnail is created, this is done by doing

$attach_data = wp_generate_attachment_metadata($attach_id, $filepath);
wp_update_attachment_metadata($attach_id, $attach_data);

One other issue with the add-on is that it is running quite late in the process, I did modify it heavily and inserted it to run during the drip of the post, as i need other plugins to have the featured_image (automatic posting to facebook, Pinterest....), after a lot of searching I found out that I also needed to set the post in draft mode during the drip and then insert all of the data for featured image and after that change it to published.

I inserted my code (alot modified from the one in the post) on line 4494 in datafeedr.php, will not slow down the pages for your visitors. If anyone needs more assistance with this please PM me..
  #26  
Old November 29th, 2014, 09:17 PM
neilmaanan neilmaanan is offline
 
Join Date: Nov 2014
Posts: 5
Default

Quote:
Originally Posted by Eric View Post
Hi,

It seems that this line is not correct:
PHP Code:
delete_post_meta($post->ID"image"); 
It's trying to delete something that doesn't even exist. Therefore the function runs way more often than it ever should.

Here's the updated code which goes in your theme's functions.php file. I've only tested that it works... it has not been tested for security or anything else.

Use at your own risk!

PHP Code:
function postmeta_img_update() {
    
    global 
$post;

    
// If Custom Post Meta Field for a Image/Thumnail Exists
    
if( get_post_meta($post->ID"store_image"true) ) {
    
        
$dfr_featured_image_is_set get_post_meta($post->ID"dfr_featured_image_is_set"true);
        
        if (
$dfr_featured_image_is_set == 'yes') {
            return;
        }

        
// Get Image Location and File Extention
        
$img get_post_meta($post->ID"store_image"true);
        
$ext substr(strrchr($img,'.'),1);

        
// WordPress Upload Directory to Copy to (must be CHMOD to 777)
        
$uploads wp_upload_dir();
        
$copydir $uploads['path']."/";

        
// Code to Copy Image to WordPress Upload Directory (Server Must Support file_get_content/fopen/fputs)
        
$data file_get_contents($img);
        
$filetitle strtolower(str_replace(array(' ''-''.''('')''!''@''#''$''%''^''&''*''_''=''+'), "-"get_the_title()));
        
$file fopen($copydir "$filetitle-$post->ID.$ext""w+");
        
fputs($file$data);
        
fclose($file);

        
// Insert Image to WordPress Media Libraby
        
$filepath $uploads['path']."/$filetitle-$post->ID.$ext";

        
$wp_filetype wp_check_filetype(basename($filepath), null );
        
$attachment = array(
            
'post_mime_type' => $wp_filetype['type'],
            
'post_title' => get_the_title(),
            
'post_content' => 'Image for '.get_the_title(),
            
'post_status' => 'inherit'
        
);

        
wp_insert_attachment($attachment$filepath$post->ID);

        
// Get Attachment ID for Post
        
global $wpdb$attachment_id $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1");

        
// Attached Image as Featured Thumbnail in Post
        
update_post_meta($post->ID"_thumbnail_id"$attachment_id);

        
// Removes Custom Meta Field Image URL. This stop this function running again for the updated post.
        
add_post_meta($post->ID"dfr_featured_image_is_set""yes");

    }
}
add_action('the_post','postmeta_img_update'); 
Eric
Hi Eric, thank you for this. I think it's working to some extent. I am using Swift Theme as my template, the code works but it displays the images at 1px by 1px.

I am starting a new site and testing the featured images first before make it full blown.

The site is fashio.nz

Hope you can help. Thanks
  #27  
Old November 30th, 2014, 09:20 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi

That's related to your theme. You'll need to contact your theme developer regarding this issue.

Eric
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:51 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.