Support » Plugin: Auto Image Attributes From Filename With Bulk Updater » Bulk updater does not respect settings

  • Resolved mathieu.pellegrin

    (@mathieupellegrin)


    Hello,

    It look like the bulk updater does not respect the settings for Auto title / caption / alt : it changes every fields even if some settings are unchecked.

    I suggest that you change from the line 337 of the main file, replace :

    	// Update the image Title, Caption and Description with the image name
    	$updated_image = array(
    	  'ID'           		=> $image->ID,
    	  'post_title'			=> $image_name,	// Image Title
    	  'post_excerpt'		=> $image_name,	// Image Caption
    	  'post_content'		=> $image_name,	// Image Description
    	);
    	wp_update_post( $updated_image );
    
    	// Update Image Alt Text (stored in post_meta table)
    	update_post_meta( $image->ID, '_wp_attachment_image_alt', $image_name ); // Image Alt Text
    

    by :

    
    	// Retrieve settings
    	$settings = get_option('iaff_settings', $defaults);
    
    	// Update the image Title, Caption and Description with the image name
    	$updated_image = array(
    	  'ID' => $image->ID,
    	);
    	if ( isset( $settings['image_title'] ) && boolval($settings['image_title']) ) {
    		$updated_image['post_title'] 	= $image_name;	// Image Title
    	}
    	if ( isset( $settings['image_caption'] ) && boolval($settings['image_caption']) ) {
    		$updated_image['post_excerpt'] = $image_name;	// Image Caption
    	}
    	if ( isset( $settings['image_description'] ) && boolval($settings['image_description']) ) {
    		$updated_image['post_content'] = $image_name;	// Image Description
    	}
    	wp_update_post( $updated_image );
    
    	// Update Image Alt Text (stored in post_meta table)
    	if ( isset( $settings['image_alttext'] ) && boolval($settings['image_alttext']) ) {
    		update_post_meta( $image->ID, '_wp_attachment_image_alt', $image_name ); // Image Alt Text
    	}
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Arun Basil Lal

    (@arunbasillal)

    Hey @mathieupellegrin

    Thanks for taking the time to checkout my plugin.

    You are right, currently the bulk updater updates everything. This is not a bug, but just the way the plugin is written right now. The documentation says that.

    The bulk updater updates ALL attributes for existing images in the Media Library and ignores the settings set for NEW uploads.

    I left it so because I haven’t decided on what to include/exclude in the pro version of the plugin.

    I am working on a new version of the plugin with more features and settings for the bulk updater.

    Thanks again.

    Actually, it also seems that the plugin does not work for new uploads, the function for new uploads retrieve the post_title instead of getting the file name from GUID (it does it correctly for bulk processing).

    I fixed these problems on my local version, would you like a patch ?

    Plugin Author Arun Basil Lal

    (@arunbasillal)

    I just tested the current version and it works perfectly for me. See this: http://awesomescreenshot.com/0456ckq091

    the function for new uploads retrieve the post_title instead of getting the file name

    WordPress stores attachments in the WP_Posts table and the post_title is in fact attachment title. You can read more about this in my article here: http://millionclues.com/wordpress-tips/automatically-add-image-caption-description-and-alt-text-from-image-title/

    Why don’t you download the live version of the plugin and test this out again. Let me know if it doesn’t work for you.

    Regards,

    Actually if the image contains EXIF data, WordPress is using it as a replacement for the title, and thus the plugin copies the EXIF data in every fields instead of using the real file name.

    You can check it with this test image : http://zupimages.net/up/17/31/m8xp.jpg the title becomes “OLYMPUS DIGITAL CAMERA”.

    Sorry if I explained the problem wrong.

    Plugin Author Arun Basil Lal

    (@arunbasillal)

    Actually if the image contains EXIF data, WordPress is using it as a replacement for the title, and thus the plugin copies the EXIF data in every fields instead of using the real file name.

    This is new info to me, thanks so much for reporting this. I have created an open ticket for the same. Will test the plugin and update it: https://wordpress.org/support/topic/exif-data-copied-instead-of-image-title/

    Plugin Author Arun Basil Lal

    (@arunbasillal)

    Actually if the image contains EXIF data, WordPress is using it as a replacement for the title, and thus the plugin copies the EXIF data in every fields instead of using the real file name.

    Hey @mathieupellegrin

    This was fixed in ver 1.3. Thanks for pointing it out and for providing the test image.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Bulk updater does not respect settings’ is closed to new replies.