[wp-hackers] Grouping uploaded media items and bulk ( programmatic ) upload method perhaps

Paul paul at codehooligans.com
Tue Nov 23 18:16:34 UTC 2010


On Nov 23, 2010, at 12:53 PM, Haluk Karamete wrote:

> suggested by Paul. But since I do not know the inner-workings of this
> particular plug-in in the way how he manages the media-tag portion, I
> don't know if it would be worthwhile to spend time in it.

The Media-tags plugin I wrote sets up a Taxonomy in WordPress. This taxonomy will function like Post Tags where you can assign one or more 'tags' to a media attachment item. The plugin is just an interface to the WordPress Taxonomy system. One note on the Media-Tags plugin. Again as I just mentioned the Media 'tags' are tags. Which means they do not support hierarchy like the category taxonomy. 

> 
> @Paul
> 
> Thank you for your suggestion. In your opinion, do you think I can
> create those media-tags programmatically? It looks like I can use the
> media-tags as folder names. Assume my current images folder on the old
> server has sub folders as people, animals, plants, then I would just
> add people as a media-tag correct. And to pull the pictures such as
> Obama, I'd type then Obama since that info would be stored in
> "caption" or "title" in the wp-uploads table.

Yes, this is very easily done using standard WP functions. Look into wp_insert_attachment http://codex.wordpress.org/Function_Reference/wp_insert_attachment
Once you have the attachment ID then you can assign tags to the item. For this look into http://codex.wordpress.org/Function_Reference/wp_set_object_terms

In the wp_set_object_terms function the third argument is the taxonomy name. If you choose to use my Media-Tags plugin then this should be set to 'media-tags'. If not then you will need to register your own taxonomy. Which is dead simple using the WP function register_taxonomy http://codex.wordpress.org/Function_Reference/register_taxonomy


> 
> @all
> 
> Currently my images are grouped in folders. Does wp-uploads folder
> store all images in one layer or does it support folder's in there as
> well? In other words, will I be able to have
> wp-uploads/old-server-images/people
> wp-uploads/old-server-images/animals
> wp-uploads/old-server-images/plants ?

I don't think by default WP supports folder grouping form images. But there might be some plugins for this. 

P-



More information about the wp-hackers mailing list