WordPress.org

Support

Support » Plugins and Hacks » ThreeWP Broadcast » Images not broadcasting correctly.

Images not broadcasting correctly.

  • 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/

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

    @edward_plainview

    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.

    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.

    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.

    Plugin Author edward_plainview

    @edward_plainview

    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?

    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.

    Plugin Author edward_plainview

    @edward_plainview

    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.

    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).

    Plugin Author edward_plainview

    @edward_plainview

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

    Plugin Author edward_plainview

    @edward_plainview

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

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

    Plugin Author edward_plainview

    @edward_plainview

    Weekends are for the weak. 🙂

    Hey Ed, your patch works perfectly. Nice work 🙂

    Plugin Author edward_plainview

    @edward_plainview

    Excellent. Will add it to Broadcast later.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Images not broadcasting correctly.’ is closed to new replies.
Skip to toolbar