Questions tagged [media-library]
Media Library is a WordPress panel that display all files you've uploaded. There you can add new files, attach files to posts and pages etc.
980
questions
105
votes
4
answers
86k
views
How to Protect Uploads, if User is not Logged In?
I use WordPress for a private site where users upload files.
I use the "Private WordPress" to prevent access in to the site if the user is not logged in.
I would like to do the same to the files ...
37
votes
4
answers
8k
views
Add a menu item to Wordpress 3.5 Media Manager
How can add a new menu item underneath the "insert From URL" on the left sidebar in the new Wordpress 3.5 Media Manager?
I've been looking at the backbone js and tried my hand at hooking into it with ...
35
votes
6
answers
15k
views
Change the default-view of Media Library in 3.5?
When inserting media into a post, is there a way to change the default-view of the Media-Library from "All media items" to "Uploaded to this post"?
There is another thread where this question was ...
34
votes
6
answers
101k
views
Get All Images in Media Gallery?
Is there a way to fetch the URLs of ALL images in the media gallery?
I think this would be an easy way for a website to have a Pictures page that just pulls all of the images from the media gallery, ...
30
votes
6
answers
47k
views
How do I select an image from Media Library in my plugin?
I have written a plugin in which you have a small chat icon in the bottom right corner, however I want the user to be able to choose an image as the icon from the Media Library. How can I do this with ...
30
votes
4
answers
61k
views
Programmatically adding images to media library
I am trying to programmatically add multiple images to media library, I uploaded the images to wp-content/uploads, now I try to use wp_insert_attachement.
Here's the code, however it's not working as ...
30
votes
6
answers
206k
views
How to Fix HTTP Error When Uploading Images?
I am using WordPress 3.4.1 on Ubuntu 12.04 using Apache and PHP 5.3.X
When I login to the dashboard and add a new post. Then try uploading an image to set as a featured image, I get a red box with a ...
30
votes
2
answers
6k
views
Enhance Media Manager for Gallery
I would like to enhance the Media Editor, after WordPress 3.5, on the gallery view.
I want to add a new select field on the right side and send the selected values to the gallery shortcode.
I think, ...
25
votes
4
answers
4k
views
Trigger refresh for new media manager in 3.5
I'm trying to figure out how it's possible to 'refresh' the media library in the new media dialogue in 3.5. I'm adding images from an external image library to the WordPress library (via a tab/iFrame ...
23
votes
1
answer
5k
views
Physical organization of wordpress media library (Real Media Library plugin)
Introduction.
In the above screenshot you can see a folder structure built with premium plugin Real Media Library. Now I want to create an extension plugin which can organize the folder structure ...
21
votes
2
answers
42k
views
Media Library plugins for better file management? [closed]
Is there any plugin to extend the basic functionality of the Media Library for websites with a lot of media content?
A folder structure would be awesome...at the moment I am using the Media Tags ...
19
votes
1
answer
2k
views
Extend Media Library
The Media Library in WordPress has "Insert from URL" link to the left. It accepts image URLs. It's not said anywhere but if you paste YouTube URL or <iframe> code then it will insert ...
16
votes
5
answers
46k
views
Upload Multiple Files With media_handle_upload
I have a WordPress form plugin and I use media_handle_upload to upload the files and get there ids directly and attached its ids to the post as a meta date, I used the following to did that:
The HTML ...
15
votes
2
answers
23k
views
WordPress 3.5: Setting custom "full URL path to files" in the Media Library?
As the recent changes in WordPress 3.5 removed the "full URL path to files" option from media library I am wondering how to set this option to a custom path now?
I need to set my "full URL path to ...
15
votes
2
answers
3k
views
Delete an attachment in the WP media modal window
I'm trying to create an option in the WP modal media window to detect duplicate files and delete a newer file if an older duplicate is found. I have the following code working (in conjunction with the ...
15
votes
6
answers
10k
views
Minimum Dimensions Requirement for Featured Image?
I am creating a baseball website with multiple Authors. From past experience, no matter how well you know someone personally, it doesn't mean they will follow or even read your instructions.
That ...
14
votes
5
answers
5k
views
Unwanted media library URLs in posts?
When doing a bit of Google searching for content on our blog, I noticed to my shock and horror that individual images from the Media Library are somehow generating their own URLs that Google is ...
14
votes
4
answers
25k
views
Upload images to remote server
I am using Wordpress media uploader to upload images and I was wondering if there is a way to make it upload to my remote server instead of my local server? Example: My wordpress blog is hosted on ...
14
votes
1
answer
30k
views
How to add subfolders in media library for better organisation?
Right now I cannot create any subfolder e.g. reviews, news, interviews etc. I have a lot of images in my media library and it's messy.
How can I create some folders and reorganize the images there?
13
votes
1
answer
5k
views
How to display .ico files in the media library
I have added a .ico mime type into my WordPress site and I'm able to upload favicon files. But the media library only displays the default.png image for these images and also in the Customizer. How ...
13
votes
0
answers
348
views
Custom collection in media manager?
I'm working on a plugin that extends the media manager, load JSON based input data to render an own collection of images and may upload them to my wordpress media library.
So far I got my own tab, ...
11
votes
1
answer
9k
views
How can I bulk delete media and attachments using WP-CLI?
I'm trying to mass delete 4000 images in a wordpress website. WP itself sets the max to 999, which would work fine and take a few minutes to delete them via the backend. However, I get REQUEST URI TOO ...
11
votes
3
answers
5k
views
WordPress 5.3 update causes media library file upload to break - Cannot convert undefined or null to object
So after updating to WP 5.3 I can no longer use the file upload to choose files to add. I get the following error:
Uncaught TypeError: Cannot convert undefined or null to object
at g.cleanup (...
11
votes
2
answers
4k
views
List of available events for wp.media
Is there a list of available events for wp.media object?
By doing some googling, I managed to find following events:
for wp.media.view.Modal.prototype: open, ready - they are triggered, when user ...
11
votes
2
answers
3k
views
Media library - Limit images to custom post type
Is there some wordpress magic/plugin that will make the media library only show images that were uploaded to a specific custom post type?
I have a custom post type called "artists", I want, when admin ...
10
votes
12
answers
26k
views
How to delete resized (cropped) image uploads and prevent future resizing?
I want to delete all the resized images while leaving the original image. I have more than 20 GB of unused data taking up room on the server. For example:
first-image-name.jpg
first-image-name-72x72....
10
votes
1
answer
12k
views
How to show all available images in WP's media library when using the Polylang plugin?
It seems that depending on which default language I've set Polylang to, all my uploaded images are isolated so that I can only pick them when I'm editing posts in the default language.
I have a lot ...
10
votes
6
answers
17k
views
Checking if a file is already in the Media Library
I'm creating custom files in a plugin and adding them to the Media Library using the code provided in the Wordpress Codex for wp_insert_attachment. However, my plugin occasionally overwrites those ...
10
votes
2
answers
6k
views
Media library to list images only user uploaded
I want to list images for only user uploaded image. Here is the scenario:
Using the image uploader on front end using iframe.
I have added upload_files cap to subscriber level users and want them to ...
10
votes
1
answer
4k
views
Adding more options to the instance of an image. (Attachment Display Settings)
I'm trying to build a simple reusable plugin for image presentation in Wordpress 3.9, and it seems I've hit a brick wall.
I would like to be able to add a couple of options to the instance of the ...
9
votes
3
answers
7k
views
How can I batch delete all unattached images with WP-CLI or other automated process?
After using WPML Media, a plugin that creates duplicates of each image for each language, we now have almost 100,000 duplicate images that we're not going to use and need to get rid of.
We need to ...
9
votes
2
answers
7k
views
Delete Associated Media Upon Page Deletion
Note
Use at your own risk, it is buggy and I have run across a couple instances where it would delete ALL attachments. Unsure why.
Is it possible to delete media associated with a page when that ...
9
votes
2
answers
8k
views
Give users a maximum upload capacity; limit the number of files a user can upload OR limit the number of files per upload
I'm using the Media Library on the front end of my website and I'd like to stop users from being able to spam my server by uploading an unlimited number of files.
As such, I'd like to do one or maybe ...
8
votes
5
answers
6k
views
Wordpress 3.5 Media Manager - add a button
In my plugin, I would like to add two buttons to Media Manager (to the left of "Insert Into Post" in "media-toolbar-primary" section), and connect a jQuery action to it.
First one - The "Select All" ...
8
votes
1
answer
9k
views
How to disable Media Library uploads for non-Admin users?
I am working on a clients site, one of the features they want is for his Editors or Authors to only be able to select existing images to insert into Posts from the Media Library.
So looking at the ...
8
votes
1
answer
23k
views
Programmatically adding images to the media library with wp_generate_attachment_metadata randomly fails
I am running the latest WordPress version (4.6) on a LAMP server (shared hosting) with PHP version 5.6.12.
I am trying to programmatically add 10 images, uploaded with ftp to the wp-uploads directory,...
8
votes
1
answer
3k
views
Rendering the uploaded file in a wp.media object
I have seen this question asked a few times on SO and I don't see any responses.
I have a wp.media object (upload dialog), that I am using in to store an upload to a post as a meta element. It works ...
8
votes
3
answers
6k
views
Get url of thumbnail from the media uploader
I want to select image from the WordPress 3.5 media uploader. I can get the image URL with the following code, but it gets the full size image. I want to get the thumbnail image url,how can I get that?...
8
votes
2
answers
5k
views
Media upload finished hook
I'm developing a plugin which uses wordpress's thickbox media library to handle media upload and selection. All is well but for the fact that I would like to automatically 'redirect' to the 'media ...
8
votes
2
answers
2k
views
Uploaded images don't show in Media Library if there are special characters in IPTC Keywords
Some images that are uploaded to WordPress don't show up in the Media Library. The images get uploaded and even cropped to the defined sizes, there is an entry in the Media Library, but the preview ...
8
votes
2
answers
4k
views
Users can't upload images on frontend if they haven't got access to the wp backend
I let users create posts and upload/attach images to that post via the frontend. This works fine. However, when I restrict the access to the Wordpress backend (/wp-admin/) via a code snippet like this ...
7
votes
1
answer
9k
views
Import media to online WordPress from local development
I have a site being developed locally and I want to import the contents to an online installation. I used wordpress "import" but it cant get the media files. Is there any "wordpress" was of doing this ...
7
votes
4
answers
8k
views
What's the proper way to find and remove duplicate images from posts and the media library?
I just exported a largish WP blog from MediaTemple to PHPFog.
I used the standard WordPress export and import plugins.
For some unknown reason all of my media assets have been duplicated. I now have ...
7
votes
2
answers
3k
views
Remove "Insert from URL" link in Media upload - WP 3.5
How do I remove the Insert from URL link in the new Wordpress 3.5 Add Media popup page? In earlier versions of Wordpress, this worked fine:
// removes URL tab in image upload for post
function ...
7
votes
3
answers
9k
views
How to track hits of a single media file?
I have multiple media files in my WordPress Media Library. Icons, Images, PDF's and the like. I would like to have a stat counter, that gives me a statistic of the downloads/hits of those files, ...
7
votes
1
answer
2k
views
Which filters or actions to use after a media upload and delete?
When a media (image) is uploaded and the subsequent images are created (all the different sizes), I would like to perform a few actions. It is simple and I basically need only the new attachment ID, ...
7
votes
3
answers
35k
views
How do I force Wordpress to show most recent version of images in the media library?
My workflow is sometimes the following:
Delete many images from the media library at once (named for example, 01.jpg, 02.jpg, 03.jpg...).
Re-upload a series of images with the same file names (01....
7
votes
2
answers
2k
views
Wordpress Media Manager 3.5 - default link to
Media Manager once again.
This time I'm looking for a simple hack/hook/filter to change default "Attachment Display Settings" from media manager. The option is "Link To" that is default set to "Media ...
7
votes
2
answers
6k
views
Javascript WP Object Documentation?
I was working on implementing the media library within one of my plugins/themes. I found a nice tutorial (http://mikejolley.com/2012/12/using-the-new-wordpress-3-5-media-uploader-in-plugins/) that ...
7
votes
1
answer
1k
views
Custom "Uploads" Dir: "Edit Image" in Media Library broken
Directory Structure
I have customized my (local) install (dev box). The current directory structure is:
./root
|- wp (WordPress Core root)
\
|- wp-config.php
|- wp-content (Content and ...