• Resolved naturfreundeschweiz

    (@naturfreundeschweiz)


    I have the problem that during broadcasting the wrong featured image is copied.
    I looked at the debugging log and I think I know what the problem is.
    The plugin can find the right attachment and all information about it but when copying the attachments the plugin does something very strange.
    The log contains the following sentences:

    Maybe copy attachment: Searching for attachment posts with the name olympus-digital-camera: SELECT ID FROM wp_posts WHERE post_type = ‘attachment’ AND post_name = ‘olympus-digital-camera’
    Maybe copy attachment: Found 2 attachment posts.
    Found attachment olympus-digital-camera and we are looking for olympus-digital-camera.
    Maybe copy attachment: The action for existing attachments is to use.
    Maybe copy attachment: Using existing attachment 2023.

    I assume that the metadata of the attachment, i.e. the name/title of the image, is used to search for the image on the other website so that the attachment need not be copied again.
    If several images have the same name/title, the wrong image is used.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author edward_plainview

    (@edward_plainview)

    The search is done using the post slug, which is generally taken from the filename.

    If it is finding the wrong image, then the fault is that the images on the parent and child blogs are not the same: image123 on the parent post does not correspond with image123 on the child, but Broadcast doesn’t know this and uses the image it finds.

    So it’s working exactly as designed (as best it can).

    What are the post slugs (post names) of the incorrect and correct attachments, for example?

    Thread Starter naturfreundeschweiz

    (@naturfreundeschweiz)

    Hi
    Featured Images (i.e Attachments in Posts) doesnt have slugs. After some more tests, i can confirm that the search is done using the title from the EXIF Image Data, which WordPress saves in a meta Table. If there is no EXIF Data to the Image everything works as expected, but if there are multiple Images with the same EXIF Title (cant be edited in a default WordPress Installation) it takes the image which was first uploaded.

    Plugin Author edward_plainview

    (@edward_plainview)

    > Featured Images (i.e Attachments in Posts) doesnt have slugs.

    Incorrect. ALL images uploaded to a site will have a slug. Therefore the SQL search for “post_name”.

    In your case, it would appear that the slug is fetched from the exif data. In most installs it is the filename that is used as the slug.

    If several images with the same filename are uploaded, they get the suffixes -2 -3 -4 -5 etc.

    In your case, since the camera model is the source of the slug, there is no way of knowing if olympus-digital-camera is the same as olympus-digital-camera-4.

    The best thing to do with images is to ensure that the filename is as unique as possible.

    Thread Starter naturfreundeschweiz

    (@naturfreundeschweiz)

    Yes thats right, sorry, i misinterpreted that.
    It’s like you described, its working as designed, but in this case the “design” is not flawless.
    Theoretically it would be possible to avoid this problem by checking a checksum on the attachment and copying the attachment with a different slug if necessary. I suppose that this addin will not be extended with such a function, right?

    Plugin Author edward_plainview

    (@edward_plainview)

    You’re the first person to request a functionality like this.

    I suppose a checksum could work, but will require some changes to the plugin since I don’t have any filters that can be used. After adding the filter I could write a code snippet for you.

    What from the image did you want checksummed?

    Thread Starter naturfreundeschweiz

    (@naturfreundeschweiz)

    A filter would be great.
    I think the Filename/Exif Title in combination with the creation date should be enough. But this only works if the creation date is also correctly transferred when inserting a new attachment. Alternatively, the file size would also be suitable.
    Actually, if you make me a filter, I can do it myself.
    But I would be grateful if you could give me a tip on how to either import the attachment under a new name or use the existing attachment during the filter.

    Plugin Author edward_plainview

    (@edward_plainview)

    I’ll make you a filter. Could you e-mail me at edward@plainviewplugins.com so that I can send you a beta version of Broadcast with the filter?

    Plugin Author edward_plainview

    (@edward_plainview)

    The filter was added in 46.03.

    Resolved!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Bug] Wrong Featured Image/Attachment’ is closed to new replies.