Support » Requests and Feedback » New gallery images via Media Library

  • Resolved ocaino


    Why is the option not available to add an image to a gallery from the already uploaded images in the Media Library? Must we continue to eat up our storage space with duplicate images? [In truth I have unlimited storage space, but I just don’t like the idea duplicate images taking up space in my directories.]

    I would like to be able to use the very same image in 10 different posts and 5 separate galleries [this is an exaggeration, but…]. So the way things are now, I would have to upload the same image no less than 5 times. I’d like to do this simply and without the need for a plugin or having to store my images in completely separate directory just to be able to use the URL option.

    WordPress – I would like to request the addition of a new button to the Add Media>Media Library>Show module: Insert into Gallery. This would fit nicely between the existing Insert into Post button and the Use as featured image link. Please consider.


Viewing 9 replies - 1 through 9 (of 9 total)
  • esmi


    Forum Moderator

    Why is the option not available to add an image to a gallery from the already uploaded images in the Media Library?

    Because a gallery is generated by listing all of the image attachments for a given post. An image is added as an attachment to a post when it is uploaded whilst in one of the page/post editing pages. Without that attachment link, it’s not possible to construct a meaningful database query.

    An image that has already been added to the Media Library is either unattached or is attached to another post. It’s just not as simple as adding another button to the UI.

    Thanx. I suppose my tone was a bit lighthearted, but I don’t think it is as simple as adding a button. What I am puzzled by is that if a single previously uploaded image can be called by multiple posts, why not multiple galleries? Or more to the point, why is it that an image, once uploaded for a gallery, is also held in the Media Library and can then be used by other posts, but this function does not work the other way around?

    Moderator Ipstenu (Mika Epstein)


    Lead Plugin Wrangler

    You’re thinking of a gallery wrong.

    An image, once uploaded for a POST, can be used on other posts.

    A GALLERY belongs to one POST only, and is a list of all images attached to the post.

    Thanx. I’m clear on that. I found the answer I was looking for:

    The way the native gallery works is due to the way WordPress wrote the code and is not a limitation of PHP and could be done if they wrote it that way.

    Thanx for all your input.

    Moderator Ipstenu (Mika Epstein)


    Lead Plugin Wrangler

    Probably the smiplest way to do what you’re describing would be to find a way to attach an image to multiple posts.

    I seem to recall Gallery or Coppermine having ‘ad hoc’ galleries, but generally speaking, built in gallery functions, that call ‘all images associated with X’ have to have a way to associate images with X.

    Gallery apps use ‘images in folders’. WordPress uses ‘images attached to post.’ Yes, it’s the app, but it’s done for reasons 😉 This keeps the CPU and memory free 😉

    Thanx. I’ve worked with my share of plugins and found many that worked for me. I’ve always been clear on the “How” of it, but the “Why” was never really made apparent.

    It would be understandable if there was no logical statement to be written in PHP that would allow it, but since it’s just a matter of not writing it, I feel the need to make the suggestion. Especially since it’s the little things like that that make WP so awesome.

    I just think that adding an image to a gallery from the Media Library should be a basic function of the native gallery. Also, any URL should be valid for the add via URL option, not just ones that don’t lead to the same directory–at least this would allow you to get around the first issue.


    I was seeking the same answers as ocaino – agree that the gallery implementation could be better.

    Ipstenu: “Probably the smiplest way to do what you’re describing would be to find a way to attach an image to multiple posts.”

    By editing the database tables directly I was able to create a ‘replica’ image — two records that pointed to the same jpeg image in the uploads folder. I attached original to one gallery, and the replica to another. One solution may lie in creating a simple plugin that gives a new button on the media library bix – say “clone media” – that creates the new unattached record. There would also need to be a reference counter somewhere so that the image could not be inadvertently deleted while still being referenced by other replicants. Works like a Unix link: $ln filea fileb

    if someone could build that plugin i would be forever grateful

    This is such a plugin:

    By the way: being used to several other CMS’s I really feel the WP way of handling images is very unfriendly. None of the systems I know have a system of attaching images to posts. This is non-intuitive and makes working with images and galleries in WP rather complex and cumbersome. The regular way of handling images in a CMS is that there is a repository (like the Media Library), where all the images are saved. Using one of multiple images on a page/post just calls those images from the repository. No need for “attaching” and fixed relations between images and the piece of content they are shown. If you want to show a gallery, just put the gallery plugin/module/tag where you want ti and link to those images you want to show from the repository.

    I really don’t understand the reasons of the WP coders to do it the current way. I don’t see any advantages either, only much confusion among new users, and frustration among regular users. Let’s hope WP will ditch the attachment concept someday…

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘New gallery images via Media Library’ is closed to new replies.