WordPress.org

Ready to get started?Download WordPress

Forums

ThreeWP Broadcast
Images not broadcasting correctly. (14 posts)

  1. thatstevensguy
    Member
    Posted 5 months ago #

    Using 2.12 we were able to broadcast featured images from custom post types in our wordpress network, however it would not store the image if there was an image with the same name on the receiving website. It would show the existing image in its place.

    Updating to 2.15, there is a new bug.

    The issue we were having in 2.12 appears to be fixed. It is trying to store new images even if there is an image with the same name. However the image itself is broken or missing, it hasn't been broadcasted properly.

    http://wordpress.org/plugins/threewp-broadcast/

  2. edward_plainview
    Member
    Plugin Author

    Posted 5 months ago #

    If you could e-mail me some screenshots and more info (say, if the image exists in the media gallery as an entry, if it exists on disk, etc) that would be helpful.

  3. flynsarmy
    Member
    Posted 5 months ago #

    Hey Edward, i've whipped up a set of steps (with example images) to replicate this issue. It's pretty easy to replicate.

    1. Create two sites on a WPMU install - site2 and site3 (I set my WPMU to subfolder instead of subdomain though I doubt this makes a difference). See here.
    2. Install ThreeWP Broadcast and network activate. See here.
    3. On your main site, add a post 'My First Post' with a featured image. Broadcast it to Site2 with 'Link this post to its children' and 'Custom Fields' checked. This will work as expected. My image filename was udata.jpg. See here.
    4. Get a different image and give it the same filename (udata.jpg). In site3, add a post 'My Second Post' with this new image a featured image. Broadcast it to site2. See here.
    5. Go to site 2's media library. You'll notice the first image is in there but the second isn't. Both posts on this site are now using the first image instead of their own unique ones. See here.
  4. flynsarmy
    Member
    Posted 5 months ago #

    For users affected by this issue, the following is a workaround that may help (untested):

    // Prefix timestamp to uploaded filenames to protect broadcasts
    add_filter('wp_handle_upload_prefilter', function($file) {
    	$file['name'] = time() . '_' . $file['name'];
    
    	return $file;
    });

    It'll uniquify uploaded files by prefixing their filenames with the current unix timestamp. It's ugly but it'll work so long as two users don't upload an identically named file at exactly the same time.

  5. edward_plainview
    Member
    Plugin Author

    Posted 5 months ago #

    Ah. The problem is that Broadcast is being too smart (by not broadcasting an image that already exists) and too stupid (not forcing a broadcast of an existing image) at the same time.

    The way I see it, the solution is to make sure that either the image is exactly the same (and not broadcast it, just use it in the post) and/or rename the image before broadcasting.

    I'm thinking there should be an option for image renaming, right? Or is it something that should be solved per blog and not in Broadcast itself?

  6. flynsarmy
    Member
    Posted 5 months ago #

    Rather than making it an option I'd play it safe and duplicate/rename all assets.

    It's better than having broadcast randomly show incorrect images when some blog author uploads an incorrectly named file leading to alot of wasted dev time figuring out what went wrong.

  7. edward_plainview
    Member
    Plugin Author

    Posted 5 months ago #

    I'd prefer it to be an option to randomize the name on each child, seeing that it's so neat and tidy now with the ability to skip existing images and not attaching them to the post unnecessarily and what not.

    I'll code up a workaround in the next version.

  8. flynsarmy
    Member
    Posted 5 months ago #

    Rather than randomizing - perhaps add a random prefix or suffix to preserve the regular image name - it might rub clients up the wrong way if their image names are suddenly random unreadable strings. SEO companies love to bullshit clients about how image filenames are important (even though they're not).

  9. edward_plainview
    Member
    Plugin Author

    Posted 5 months ago #

    Yeah. I'm building a setting for ignoring / overwriting / randomzing (suffix) existing images.

  10. edward_plainview
    Member
    Plugin Author

    Posted 5 months ago #

    @flynsarmy: I'm sending you the latest beta version of Broadcast so that you can test the new attachment conflict handling.

  11. flynsarmy
    Member
    Posted 5 months ago #

    Thanks Ed, Will test it out on Monday when I get back in to work.

  12. edward_plainview
    Member
    Plugin Author

    Posted 5 months ago #

    Weekends are for the weak. :)

  13. flynsarmy
    Member
    Posted 5 months ago #

    Hey Ed, your patch works perfectly. Nice work :)

  14. edward_plainview
    Member
    Plugin Author

    Posted 5 months ago #

    Excellent. Will add it to Broadcast later.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.