distributor icon indicating copy to clipboard operation
distributor copied to clipboard

Option to skip distributing attached media

Open helen opened this issue 7 years ago • 7 comments

Attachments are frequently a point of failure in terms of time outs and in many situations don't need to be distributed because the original source uses third-party hosting for media or can continue to serve as the canonical source for media. There are also situations where it's not appropriate for the media to be copied elsewhere. There should be a way to skip distributing media, both in terms of code and in UI.

Related: #152

helen avatar Jul 13 '18 19:07 helen

For people looking to prevent or manipulate the distribution of images: the dt_push_post_media filter allows you to disable or replace the handling of images for internal connections.

It would be great to add something similar to prepare_media() to be able to filter the attachments to be distributed. Either to shortcut it or to add other media to it, eg, from a gallery custom field.

barryceelen avatar Jul 13 '18 19:07 barryceelen

After discussing this issue (and #152) with the team, here's a proposal on how to proceed here.

Short Term Currently we distribute the featured image and any images attached to the post object. But the only image source we actually update on the receiving end is the featured image, meaning the processing of any other images will typically be unneeded overhead.

In the short term, propose that we change up how we handle media, to distribute only the featured image by default and have an option to distribute all attached images. This option can be both a filter in the code, as well as an option in the admin, both of which would be turned off by default. If either of those options are used, we will send over attached images, but note that we still won't update image URLs in the content. Also propose standardizing the filters we have, so you can choose to not distribute images for both internal and external connections, instead of just the internal like it is now.

Long Term Looking towards the future and what we can do better for media handling, propose that we add new options in the admin. So in addition to having the option to distribute the featured image and all attached images, we will add a new option to distribute all images associated with a post.

Would need to figure out the exact logic here, but the idea is to parse through the post_content and find any image referenced there, sending those images along. This solves the issue of a post that has images in the content, but those images aren't actually attached. Currently we only send attached images, so any other images are never sent along.

In addition to this change, we will also parse through the distributed post and update the image URLs to point to the new site, instead of leaving those pointing to the origin site. Would need to figure out how we handle different image sizes between sites, as well as if we want to look through post meta and update images there.

dkotter avatar Aug 02 '18 14:08 dkotter

Also: Image handling in Distributor has a bit of a batch-like nature. It would be awesome if we could pluck the various functions apart to make it easier to distribute/handle/assign-to-an-async-task a single image.

barryceelen avatar Aug 02 '18 14:08 barryceelen

Would a convenient option not also be just to make the source URL of any images point back to the original article? I would think it would substantially reduce the size, processing time and failure rate when pushing out to multiple sites.

PaddyWhacks avatar Oct 02 '18 10:10 PaddyWhacks

@PaddyWhacks That's the current behavior for in-content images, where URLs are not rewritten, but certain things such as featured images reference IDs.

helen avatar Oct 02 '18 17:10 helen

Ah okay... And I supposed somehow making the feature image draw from a URL isn't practical? Sorry I'm more of an end user and haven't dug into the nuts and bolts. Maybe replicating functionality similar to this plugin ?

PaddyWhacks avatar Oct 03 '18 10:10 PaddyWhacks

Ran into a failure again due to the featured image being sent as an attachment. Just thought I would clarify my thinking - not sure if this would be possible, but the end result would be to have an additional setting under media handling - "Do not attach featured images - draw directly from the origin post".

If it is practical to do, could one not just have the featured image src link through to the origin post's featured image. That way you would not be sending/uploading any media - I would think it would reduce failures and be better for updating posts.

PaddyWhacks avatar Nov 29 '18 06:11 PaddyWhacks