Quantcast

Attaching photos to multiple posts

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Attaching photos to multiple posts

William P. Davis-2
One of the biggest hurdles to overcome, in my opinion, when using  
WordPress as a full-on CMS is the inability to attach photos to  
multiple posts. I've been mulling over a solution for some time, and I  
think I've found an acceptable solution, but I wanted to float it here  
to make sure there wouldn't be any adverse effects.

A few ideas that I've had involve meta data or custom taxonomies, like  
Co-Authors Plus uses. But I thought the best solution might be to  
essentially duplicate the attachment and attach the duplicate  
attachment to the post, so that it degrades gracefully if the plugin  
is deactivated. Essentially, copy over the post (but don't create a  
duplicate image, to save server space). Does anybody anticipate any  
problems?

Thanks,
Will
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

aesqe
That's exactly how I did it in my File Gallery plugin :)

Each attachment copy gets a meta key '_is_copy_of' (value = original
attachment ID ), and each 'original' attachment gets a meta key
'_has_copies' (value = array with IDs of all of its copies).

(shameless plugin link: <http://wordpress.org/extend/plugins/file-gallery/>)

I'd also like to know if anyone has any problems with this method, or
suggestion of a better way to do it.


cheers ;)

On 2.2.2011 22:44, William Davis wrote:

> One of the biggest hurdles to overcome, in my opinion, when using
> WordPress as a full-on CMS is the inability to attach photos to multiple
> posts. I've been mulling over a solution for some time, and I think I've
> found an acceptable solution, but I wanted to float it here to make sure
> there wouldn't be any adverse effects.
>
> A few ideas that I've had involve meta data or custom taxonomies, like
> Co-Authors Plus uses. But I thought the best solution might be to
> essentially duplicate the attachment and attach the duplicate attachment
> to the post, so that it degrades gracefully if the plugin is
> deactivated. Essentially, copy over the post (but don't create a
> duplicate image, to save server space). Does anybody anticipate any
> problems?
>
> Thanks,
> Will
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

Otto-19
In reply to this post by William P. Davis-2
On Wed, Feb 2, 2011 at 3:44 PM, William Davis <[hidden email]> wrote:
> One of the biggest hurdles to overcome, in my opinion, when using WordPress
> as a full-on CMS is the inability to attach photos to multiple posts.

What exactly do you need that for? What's the use case?

Just curious.

-Otto
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

Paul Menard-3
In reply to this post by William P. Davis-2

On Feb 2, 2011, at 4:44 PM, William Davis wrote:

> One of the biggest hurdles to overcome, in my opinion, when using WordPress as a full-on CMS is the inability to attach photos to multiple posts. I've been mulling over a solution for some time, and I think I've found an acceptable solution, but I wanted to float it here to make sure there wouldn't be any adverse effects.
>
> A few ideas that I've had involve meta data or custom taxonomies, like Co-Authors Plus uses. But I thought the best solution might be to essentially duplicate the attachment and attach the duplicate attachment to the post, so that it degrades gracefully if the plugin is deactivated. Essentially, copy over the post (but don't create a duplicate image, to save server space). Does anybody anticipate any problems?

I've often thought there needs to be a better solution. Something better than having an image be a child or the parent post. Mainly because I came from using other CMS systems where they manage this different. And from the functional perspective like I want to change the image which is used across multiple pages. Or for example I see an image in the Media section and want to know that posts reference this image in the post_content. This is not built in functionality but is pretty easy to determine.

Then again the user does have access to all images used on the site. Having that one to one association with a parent does not prevent using that image in multiple post. So for inserting images the user doesn't really care that one image is associated with a page or post and which image are not.

I really don't see that creating duplicate entries in the database will be any more efficient. Not to mention cleanup when an image is deleted from the system. Sure this can be done. But the question should be why.

Final answer -1.

P-

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

William P. Davis-2
In reply to this post by Otto-19
We don't embed images in posts, we query the post's attachments and  
display them above the article and in a sidebar (see: http://new.bangordailynews.com/2011/02/02/news/bangor/roads-deserted-offices-closed-as-weekly-storm-hits-maine/)
. This is important for for several reasons, mainly that the content  
is then pushed to our print edition and I don't want to have to worry  
about stripping out cutlines and credits, also so that we can display  
different-sized images on our homepage (http://
new.bangordailynews.com/) , etc. We don't embed anything in the text  
of the story and instead use attachments to make sure all data is  
properly fielded.

Will

On Feb 2, 2011, at 5:12 PM, Otto wrote:

> On Wed, Feb 2, 2011 at 3:44 PM, William Davis <[hidden email]>  
> wrote:
>> One of the biggest hurdles to overcome, in my opinion, when using  
>> WordPress
>> as a full-on CMS is the inability to attach photos to multiple posts.
>
> What exactly do you need that for? What's the use case?
>
> Just curious.
>
> -Otto
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

William P. Davis-2
> We don't embed images in posts

I'd add that it's fairly standard for newspapers to avoid embedding  
images in content in order to avoid problems with going across  
platforms.
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

Foolish Visions
In reply to this post by William P. Davis-2
I've done something similar, but I use the Shiba Media Library plugin. It puts tags on images, and you can create galleries via tags.  You can also pop images into posts by tag.  So instead of copying images over and over and attaching them to posts, you can just tag them and reuse them. She has another Gallery plugin that goes with it, so you can create galleries by tag and manage them easily.

~Shelly
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

Otto-19
In reply to this post by William P. Davis-2
On Wed, Feb 2, 2011 at 4:21 PM, William Davis <[hidden email]> wrote:
> We don't embed images in posts, we query the post's attachments and display
> them above the article and in a sidebar (see:
> http://new.bangordailynews.com/2011/02/02/news/bangor/roads-deserted-offices-closed-as-weekly-storm-hits-maine/).
> This is important for for several reasons, mainly that the content is then
> pushed to our print edition and I don't want to have to worry about
> stripping out cutlines and credits, also so that we can display
> different-sized images on our homepage (http://new.bangordailynews.com/) ,
> etc. We don't embed anything in the text of the story and instead use
> attachments to make sure all data is properly fielded.

Okay, that's great, but I'm not seeing why you can't just upload the
image again to attach it to another post? What's the issue with that?
Disk space?

What I mean is, what exactly would attaching an "attachment" to more
than one post really enable you to do? Because there's probably a
better way to do it than using attachments at all, in that case. Off
the top of my head, provide a selection mechanism that saves
"attached" images as postmeta. Or tag images and use some kind of
taxonomy scheme. Half a dozen different ways.

You need to define the problem before defining how to solve it. What
is the problem that you're wanting to solve here? Do you want some way
to select images from a thumbnail UI and have those then "attached" to
that post in some manner? Or what?

-Otto
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

Jane Wells-2
On 2/2/11 6:08 PM, Otto wrote:
> Okay, that's great, but I'm not seeing why you can't just upload the
> image again to attach it to another post? What's the issue with that?
> Disk space?
Why even upload it again? Can't you just choose it from the media library?
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

Otto-19
On Wed, Feb 2, 2011 at 5:29 PM, Jane Wells <[hidden email]> wrote:
> On 2/2/11 6:08 PM, Otto wrote:
>>
>> Okay, that's great, but I'm not seeing why you can't just upload the
>> image again to attach it to another post? What's the issue with that?
>> Disk space?
>
> Why even upload it again? Can't you just choose it from the media library?

He specified "attaching" it to the post without actually having the
image embedded into the post's content. An attachment, as it is, only
can have one parent.

-Otto
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

William P. Davis-2
In reply to this post by Otto-19
On uploading it again: That's a lot of extra work (finding the image,  
uploading it, editing the cutline and crop, etc.) that a lot of  
newsrooms don't have.

Jane: On choosing it from the media library: You can't select a photo  
from the media library that's attached to another post except to embed  
it. As mentioned below, we don't embed images.

Otto: I mentioned postmeta and taxonomies earlier. Two reasons I  
rejected these were that oftentimes we want to edit the caption  
between two different use cases (for example, a photo of our governor  
on one story might have a full description of what he's doing, while  
the other might just simply state his name and use the photo for  
illustrative purposes; and that we would want to order the photos as  
well, which can certainly be done with postmeta and taxonomies but not  
as easily as, for example, defining menu_order.

The problem is as follows: For our purposes (and I understand this  
probably isn't a core feature) we need an easy way to attach file  
photos to posts (for example, on many continuing stories we'll use the  
same photo three, four, five times). As I mentioned already, uploading  
it multiple times is rather cumbersome.

Thanks for your thoughts thus far already.
Will

> Okay, that's great, but I'm not seeing why you can't just upload the
> image again to attach it to another post? What's the issue with that?
> Disk space?
>
> What I mean is, what exactly would attaching an "attachment" to more
> than one post really enable you to do? Because there's probably a
> better way to do it than using attachments at all, in that case. Off
> the top of my head, provide a selection mechanism that saves
> "attached" images as postmeta. Or tag images and use some kind of
> taxonomy scheme. Half a dozen different ways.
>
> You need to define the problem before defining how to solve it. What
> is the problem that you're wanting to solve here? Do you want some way
> to select images from a thumbnail UI and have those then "attached" to
> that post in some manner? Or what?
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

Andrew Nacin-2
On Wed, Feb 2, 2011 at 6:40 PM, William Davis <[hidden email]> wrote:

> On uploading it again: That's a lot of extra work (finding the image,
> uploading it, editing the cutline and crop, etc.) that a lot of newsrooms
> don't have.
>
> Jane: On choosing it from the media library: You can't select a photo from
> the media library that's attached to another post except to embed it. As
> mentioned below, we don't embed images.
>
> Otto: I mentioned postmeta and taxonomies earlier. Two reasons I rejected
> these were that oftentimes we want to edit the caption between two different
> use cases (for example, a photo of our governor on one story might have a
> full description of what he's doing, while the other might just simply state
> his name and use the photo for illustrative purposes; and that we would want
> to order the photos as well, which can certainly be done with postmeta and
> taxonomies but not as easily as, for example, defining menu_order.
>
> The problem is as follows: For our purposes (and I understand this probably
> isn't a core feature) we need an easy way to attach file photos to posts
> (for example, on many continuing stories we'll use the same photo three,
> four, five times). As I mentioned already, uploading it multiple times is
> rather cumbersome.
>
> Thanks for your thoughts thus far already.
> Will


One problem is that you can't have your cake and eat it too.

Allowing a photo to be associated with more than one post at a time means
that you can't edit the caption. And yes, coming from journalism, I
absolutely see the use case in associating the caption with the distinct
point of attachment of the photo, rather than the photo itself.

That leads me to the next point, which could be that uploading it again
might actually be the most painless way to do it. That allows you to crop or
scale things as well as customize captions and metadata. (Even media credit
could be customized at the point of attachment, rather than the photo; for
example, over time a photo might become a 'file photo' rather than the
original photographer, which sometimes the policy in media organizations.)

The solution? I'm not sure, but I see it less as a technical one and more as
one that is custom to your particular implementation.

Perhaps a method that allows copying of attachments -- the record is
inserted as a new attachment and new files are generated. But you can still
keep them linked via postmeta fields and synchronize the data you
specifically want, whenever you wish to modify one or the other. That keeps
the burden down of downloading then uploading a file whenever you want to
reuse it.

I also like the simple approach of tying attachments to posts not only via
post_parent but also with postmeta on the parent post. (Taxonomy works too.)
Then to get attachments tied to a post, you'd query by postmeta value
instead. This doesn't break the conventions of how WordPress stores
attachments, but still provides the ability of not needing to embed images
in post content. You still have issues with attachments but perhaps that's
another thing that can go into postmeta.

I agree strongly with Otto that it isn't about the solution, it's about the
problem. Identify exactly what you want to achieve, and then find a solution
that fits your needs. If our use cases are close, I'd be willing to work on
this as well, as I'd like to leverage it myself somewhere, so let me know
offline.

Hope that helps,
Nacin
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

William P. Davis-2
Thanks for your response, Andrew. I agree, the problem needs to be  
more thoroughly defined, and I definitely want to hear others' use  
cases so a plugin can be built that solves as many as possible as  
eloquently as possible.

Will


On Feb 3, 2011, at 6:56 PM, Andrew Nacin wrote:

> On Wed, Feb 2, 2011 at 6:40 PM, William Davis <[hidden email]>  
> wrote:
>
>> On uploading it again: That's a lot of extra work (finding the image,
>> uploading it, editing the cutline and crop, etc.) that a lot of  
>> newsrooms
>> don't have.
>>
>> Jane: On choosing it from the media library: You can't select a  
>> photo from
>> the media library that's attached to another post except to embed  
>> it. As
>> mentioned below, we don't embed images.
>>
>> Otto: I mentioned postmeta and taxonomies earlier. Two reasons I  
>> rejected
>> these were that oftentimes we want to edit the caption between two  
>> different
>> use cases (for example, a photo of our governor on one story might  
>> have a
>> full description of what he's doing, while the other might just  
>> simply state
>> his name and use the photo for illustrative purposes; and that we  
>> would want
>> to order the photos as well, which can certainly be done with  
>> postmeta and
>> taxonomies but not as easily as, for example, defining menu_order.
>>
>> The problem is as follows: For our purposes (and I understand this  
>> probably
>> isn't a core feature) we need an easy way to attach file photos to  
>> posts
>> (for example, on many continuing stories we'll use the same photo  
>> three,
>> four, five times). As I mentioned already, uploading it multiple  
>> times is
>> rather cumbersome.
>>
>> Thanks for your thoughts thus far already.
>> Will
>
>
> One problem is that you can't have your cake and eat it too.
>
> Allowing a photo to be associated with more than one post at a time  
> means
> that you can't edit the caption. And yes, coming from journalism, I
> absolutely see the use case in associating the caption with the  
> distinct
> point of attachment of the photo, rather than the photo itself.
>
> That leads me to the next point, which could be that uploading it  
> again
> might actually be the most painless way to do it. That allows you to  
> crop or
> scale things as well as customize captions and metadata. (Even media  
> credit
> could be customized at the point of attachment, rather than the  
> photo; for
> example, over time a photo might become a 'file photo' rather than the
> original photographer, which sometimes the policy in media  
> organizations.)
>
> The solution? I'm not sure, but I see it less as a technical one and  
> more as
> one that is custom to your particular implementation.
>
> Perhaps a method that allows copying of attachments -- the record is
> inserted as a new attachment and new files are generated. But you  
> can still
> keep them linked via postmeta fields and synchronize the data you
> specifically want, whenever you wish to modify one or the other.  
> That keeps
> the burden down of downloading then uploading a file whenever you  
> want to
> reuse it.
>
> I also like the simple approach of tying attachments to posts not  
> only via
> post_parent but also with postmeta on the parent post. (Taxonomy  
> works too.)
> Then to get attachments tied to a post, you'd query by postmeta value
> instead. This doesn't break the conventions of how WordPress stores
> attachments, but still provides the ability of not needing to embed  
> images
> in post content. You still have issues with attachments but perhaps  
> that's
> another thing that can go into postmeta.
>
> I agree strongly with Otto that it isn't about the solution, it's  
> about the
> problem. Identify exactly what you want to achieve, and then find a  
> solution
> that fits your needs. If our use cases are close, I'd be willing to  
> work on
> this as well, as I'd like to leverage it myself somewhere, so let me  
> know
> offline.
>
> Hope that helps,
> Nacin
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attaching photos to multiple posts

defineinstruments
This post has NOT been accepted by the mailing list yet.
I realise that this is a very old thread, but I've been searching on and off for a solution to this problem for years, and was wondering if anyone had come up with anything...

I am using WP with WooCommerce as a product catalogue, and each of my products has a manual attached to the post. (Attached, not inserted!) I'm also using File List Pro, which dynamically generates a list of media attached to the current post, and I've set this up to automatically display in a 'downloads' tab on each product page. So far so good, but there are some manuals that have been designed to work for multiple products. And under the current setup, my only way to do display these is to upload them multiple times, and then attach the copies to the different products. Some of my manuals are extensive (several MB download!) so it seems very cumbersome to have to duplicate them.

I have tried a few plugins in the past that get around this using custom taxonomies or simliar (as mentioned above), but I would prefer not to go this route. My reason is that doing it this way immediately creates issues with other plugins and themes that manage media files using the WP attachment structure.

The ability to easily attach one media file (be it pdf or an image!) to multiple posts is something that I would happily pay for - does anyone have any further ideas?
Loading...