• Changed a slide with the new “Change slide image” option and then changed it back to previous image.

    Somehow this changed the file-url of the previous image post in media library to the file-url of the new image. So now the media library entry of the old image shows all metadata of the old image but has the file-url to the new image set.

    Also the new image was duplicated 2x in upload folder. Something went really wrong, won’t try again for now.

    Besides the problem, the plugin should not write anything to the media library entry. In this case the meta _wp_attached_file of the previous image id was changed to the url of the new image. Had to fix the url directly in DB and force regeneration of thumbnails.

    Note: The previous image was saved in an /uploads/yyyy/mm/ folder, while the new image was saved directly in /uploads/ – the relevant setting of WordPress was changed between these two uploads.

    Can somebody confirm this behaviour?

    https://wordpress.org/plugins/ml-slider/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Ov3rfly,

    Thanks for reporting this.

    So we’re on the same page, here’s what happens when you change the slide image:

    1. The image you want to change to is duplicated on your server. It should* go into the same folder as before, but the filename will have a “1” on the end of it (or whatever the “wp_unique_filename” function decides).
    2. The slide db record (nb, a slide is just a media file) is then updated to point to the duplicated file.

    The file is duplicated to ensure that 2 media files don’t end up sharing the same physical image (that becomes an issue if one of the media files is deleted).

    So the result should be that everything remains the same (metadata etc) apart from the path to the image on the slide.

    You’ll see 2 media files that look identical in your Media Library because we’ve copied the image from one media file to another, but the old media file will remain unchanged.

    Does that match up with your findings?

    *this sounds like a bug, is there anything unique about your installation? Maybe Multi Site or running on Windows?

    Regards,
    Tom

    Thread Starter Ov3rfly

    (@ov3rfly)

    The main problem (or bug?) was, that the database entry meta _wp_attached_file of the previous image id was changed to the url of the new image. There should be no reason at all for a write to this entry in your described process.

    Both images were uploaded via normal Media Library and later selected from there in the Plugin.

    No multisite, no windows.

    Thread Starter Ov3rfly

    (@ov3rfly)

    Simple Testcase:

    • Upload e.g. 4 images to Media Library
    • Create new Slideshow
    • Add Image1, Image2, Image3 to Slideshow
    • Save
    • Replace Image2 with Image4 via “Change slide image” feature
    • Open Media Library
    • Image2 entry has been changed, contains now Image41 URL

    Clearly a bug.

    Hi Ov3rfly,

    Apologies for the delay getting back to you. The testcase you’ve provided is how I’d expect it to work (its similar to how it would work if you used the Replace Media plugin directly on a media file), could you explain how you think it should work please? It’s not set in stone so I can always change it if there’s a better way 🙂

    Regards,
    Tom

    Thread Starter Ov3rfly

    (@ov3rfly)

    I would expect that such a feature would remove one slide from the slideshow and replace it with a new slide (including the new title/alt/etc from the new image). Like you would delete the slide from the slideshow an add a new one.

    I would never expect that such a feature would actually overwrite the image-path of an existing media library entry.

    Scenario at my customer: Image2 is also used on pages, in articles as inline image and similar. After the testcase these pages and articles show Image41 instead of Image2, but with Image2 caption etc. That’s not good.

    A slider plugin should be basically a collection of media library IDs and only override title/alt/etc. of the media library entry if configured within the slider plugin and store such configuration in some slider plugin meta/options. It should never actually write to original medial library entry.

    Thread Starter Ov3rfly

    (@ov3rfly)

    Any news here?

    Had to remove the “change image” button at my customer in the meantime to avoid further unwanted changes to media library entries.

    Added this CSS to admin area until problem is fixed.

    div.metaslider tr.slide a.change-image {
    	display: none;
    }

    Hi Ov3rfly,

    The functionality has been removed in 3.2.1 until I work something out.

    Regards,
    Tom

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘"Change slide image" problem’ is closed to new replies.