• WP 4.4.2 Imsanity 2.3.6

    It seems this plugin version does not update the metadata Width/Height fields in /imsanity/libs/utils.php > function imsanity_image_resize()


    // Get MetaData with wrong W/H:
    $ay_metadata = wp_get_attachment_metadata( $attachment_id, true );

    // Load WP-ImageEditor (WP 3.5+)
    $editor = wp_get_image_editor(get_attached_file($attachment_id));

    // Get correct W/H
    $ay_imgrealdim = $editor->get_size();

    // Cache real Width/Height
    $ay_metadata['width']=$ay_imgrealdim['width'];
    $ay_metadata['height']=$ay_imgrealdim['height'];

    // Save MetaData with correct W/H
    wp_update_attachment_metadata( $attachment_id,$ay_metadata);

    https://wordpress.org/plugins/imsanity/

Viewing 1 replies (of 1 total)
  • Thread Starter karimun

    (@karimun)

    Update:
    This happened when importing images with another plugin (in my case WP All Import) = IMSANITY_SOURCE_OTHER

    Uploading images directly in the library works as expected.

Viewing 1 replies (of 1 total)
  • The topic ‘Metadata Width/Height not updated after resize’ is closed to new replies.