Questions tagged [media]
An image, audio or a video comprises a media.
424
questions with no upvoted or accepted answers
4
votes
0
answers
104
views
Saving WordPress generated thumbnails in a subdirectory
I.e. an uploaded image image.jpg is stored in wp-content/uploads/2016. WordPress will generate thumbnails named image-150x150.jpg, image-300x300.jpg, and image-1024x1024.jpg in the same directory.
Is ...
3
votes
3
answers
2k
views
How to automatically convert images to WebP on WordPress?
I want to convert every PNG and JPEG to WebP on upload so that I can serve WebP and PNG/JPEG without requiring the user to upload a WebP version of every photo.
I want to save the WebP in the same ...
3
votes
1
answer
1k
views
Restrict file types in the uploader of a wp.media frame
When creating a wp.media frame in JS, is it possible to specify allowed file types for the uploads tab?
wp.media({
title: 'Pick a PDF',
button: {
text: 'Use this file...'
},
...
3
votes
0
answers
586
views
Retroactively place uploaded media into -month, -year based folders?
I am working on a client's site. It has about 8GB of images in the uploads folder. Unfortunately, from day one, years ago, uploaded media files were not set to be organized into month-, year- based ...
3
votes
0
answers
590
views
Media upload via backend doen't work after moving site
I have copied my site to a subdirectory for test purposes, everything works fine now. The only problem I have seen so far is the Media upload. When I try to upload a file I get a:
Unable to create ...
3
votes
1
answer
1k
views
How to disable drag-and-drop upload function in Media Library?
Does any one knows a valid/standard way to disable drag and upload when accessing the media library in the admin area? In order to make this sense to you, I'm building a multisite and user of sub-site ...
3
votes
0
answers
2k
views
Custom media picker in meta box: how to select available image sizes?
I have a custom meta box where a user can select an image and save it using wordpresses media picker, set up with some JavaScript.
That works fine, but I'd like the option to select which version of ...
3
votes
0
answers
187
views
Category checkboxes in upload modal
In a project I'm working on, I've enabled categories for attachments using:
register_taxonomy_for_object_type('category', 'attachment');
In the edit attachment screen in the Media Library you see ...
3
votes
3
answers
2k
views
Retrieving JSON data in ajax request from media uploader
I'm having some problems getting my JSON data that's being passed via an ajax request.
I'm trying to implement the media uploader into a plugins settings page. I've got it functioning properly using ...
2
votes
0
answers
54
views
How do I display a PDF thumbnail as a link to the PDF without uploading the image
When I found a couple of years ago that WordPress will create thumbnails of uploaded PDFs, I was so happy, thinking I wouldn't have to make and upload separate PDF cover images to have a thumbnail ...
2
votes
0
answers
617
views
How to change upload directory based on frontend form input name or ID?
I created a frontend form using a plugin which allows logged in users to create draft posts. There are 3 file upload areas. I need 1 of them to use the default public WP media upload folder as usual. ...
2
votes
0
answers
272
views
How to search media library alt text and title fields
I need to be able to search in the WordPress media library alt text and title fields.
I've previously used a plugin called Media search Enhanced by 1fixdotio (https://wordpress.org/plugins/media-...
2
votes
0
answers
147
views
How to host different file formats/types for a media attachment without creating multiple attachments?
For a better browser compatibility we often have to maintain multiple format of a media.
For example:
Image - JPG & WebP
Image animated - GIF & WebP
Image transparent - PNG & WebP
Video - ...
2
votes
0
answers
160
views
wp_get_attachment_image_src() returns wrong url
wp_get_attachment_image_src() is returning a wrong image url. It returns the original url instead of the cropped one. Here some example code:
$ptId = get_post_thumbnail_id( $productId );
...
2
votes
0
answers
46
views
How to re-arrange media uploaded using : media_handle_upload() as per year / month
I have been facing this issue that all the new media files are getting uploaded to single folder which was auto-generated during initial site development.
Now since all new images are getting uploaded ...
2
votes
0
answers
629
views
Wordpress API returns empty page when page is less than X-WP-TotalPages
I am querying in the Wordpress API for all pages of media attachments.
I am going page by page.
I have about 5800 pages and when I hit pages 50-53 they return a blank or more of a [] but it is a ...
2
votes
0
answers
2k
views
move_uploaded_file() not working on wordpress front end
I have working code that uploads an image from the front end and sets it as a featured image and custom field photo for a custom post type but I am unable to figure out how to set the upload path.
...
2
votes
1
answer
519
views
How to install/enable mediaelement.js plugins in WordPress
MediaElement.js has a lot of useful plugins, such as jump forward, skip back, speed, etc.
From my understanding (please correct me if I am wrong) WordPress core contains only MediaElement.js -- ...
2
votes
0
answers
50
views
How to stop unlink images when remove a site or user
What's the best way to prevent images deleting?.
I have a central cdn site to share images to several sites on wordpress multisite, and by mistake, I have remove a user from the network and all my ...
2
votes
0
answers
157
views
wordpress multisite subsite rewrite rules not working for videos
We have an issue on our site whereby videos uploaded to posts on subsites are returning a 404 when attempted to be viewed, whereas for instance images attached to subsite posts display just fine. We'...
2
votes
0
answers
72
views
Sending custom data with Media Frame Model
I have an option on post edit screen that can change it to full-width. Unfortunately, $content_width still follows the standard one with sidebar 780px (without saving the post or a whole refresh).
I ...
2
votes
0
answers
429
views
Multisite media library uploads broken images
I am having an issue with one of my sub-sites media library. All it uploads are broken images. It loads fine locally but for some reason it gives me the error
"Failed to load resource: the server ...
2
votes
0
answers
724
views
Media is shown in listview but not in gridview whenever i activate my Custom Theme
Whenever I activate my custom theme the media is shown in list view only not in grid view. When I checked it by inspect element data is not coming in it and when i try to upload any image it shows me ...
2
votes
0
answers
204
views
Add custom tab on the media manager
I want to add a new tab and its content on the media manager. I have used add_filter('media_upload_tabs', 'mime_type_tab' , 1 , 1 ); but that filter it is not working on the featured image pop up.
2
votes
1
answer
475
views
WP Media uploader loading only once in options page
A weird issue happening with me which I am unable to fix. In my theme options page, I added options to upload images one for logo and another for backgroud image. Here is my HTML
<table class="...
2
votes
2
answers
5k
views
How To install AWS SDK for PHP in wordpress?
I am going to install and use AWS SDK for PHP to facilitate uploads/list objects directly from the front-end of my WordPress instance to S3. What is the best practice to do that ?
P.S: I don't want ...
2
votes
1
answer
97
views
Disable mouse image resizing in editor
I want to disable the mouse image resizing function in wordpress standard editor. So that its not possible to resize the default image size when you select an image and pull on it.
Any idea how i can ...
2
votes
0
answers
42
views
Add input to the media uploader and pass its value to each uploaded file
Suppose I have a select element containing a list of my custom taxonomies or terms, I need to add it to the media library uploader so that the admin can choose the custom taxonomy to which he wants to ...
2
votes
0
answers
1k
views
How to delete uploads not in media library?
How to delete uploads not in media library? I have lot of images in my uploads folder but doesn't in media library. Exist some method how this do it?
2
votes
1
answer
502
views
Different upload path per file type
I want to have two different paths for different files.
For example, I have all .zip and image files all in the same locations.
What I am wanting to the have images in one path (eg. wp-content/...
2
votes
0
answers
180
views
wp.media add context
I have wp.media frame on my plugin to upload doc, docx file. I am filtering the uploaded file.
If uploaded other than supported file, it will display this error
I am filtering it at ...
2
votes
0
answers
68
views
Add fields to the WordPress media uploader
I am trying to add an URL field to the WordPress media uploader using following code:
/**
* Add an URL field to gallery attachments
*
* @param $form_fields array, fields to include in attachment ...
2
votes
1
answer
79
views
Organizing media uploads
One of my clients wants to transfer his WordPress website to my server. The problem is his website doesn't use sub-folders in his upload folder, and he has more than 1,000,000 files in the root of his ...
2
votes
0
answers
670
views
How to make a customized "Create Gallery" tab in the 'Add Media' window?
I'm developing a plug-in and wanting to make a customized version of the the "Create Gallery" tab of WP v4.0, but have the resulting output (i.e. what gets inserted into the TinyMCE editor) to be ...
2
votes
1
answer
293
views
3.5 media.editor: what is the event listener for choosing an image?
What is the event listener for selecting an image in the media.editor javascript. I am attempting to add a multiple image selector to a custom plugin, and I need to show the user what images they have ...
1
vote
1
answer
52
views
How can I get all attachments by a user on a WP multisite network?
I'm creating a front-end based project where users can make posts and add images to them. It's a network of sites that users have access to.
For a better user experience, I want users to be able to ...
1
vote
0
answers
42
views
Problem with "is_user_logged_in()" and woocommerce (Code for custom media upload for each author.)
I'm sorry for my english...
I am using the following code to create separate media directories for each author..
( Thanks to https://wordpress.stackexchange.com/a/400352/220907 )
function ...
1
vote
1
answer
124
views
wp media regenerate says "no regeneration needed" whe that's no the case
I'm trying to generate thumbnails for a PDF attachment. Right now in the uploads/ folder there is only the PDF file, no image thumbnails related to it.
But when I run the regeneration with :
wp media ...
1
vote
0
answers
41
views
upload image to wordpress media library failed for custom post type
image upload failed. I tried to upload gym logo as thumbnail image for gym post type. All the form elements are working. But image upload is not working. images are not appearing in WordPress media ...
1
vote
0
answers
50
views
Give attachments an archive page, and exclude unattached ones
I am extending the use of Media/"Attachments" so that they have a custom taxonomy of "Medium" and I can display taxonomy archives on the frontend. I'd only like the archive query ...
1
vote
1
answer
32
views
How can I create more upload paths, like a post corresponding to a post title folder used to store images of the same product
How can I create more upload paths, like a post corresponding to a post title folder used to store images of the same product.
Because I want to make a photo album blog, the images within each post ...
1
vote
2
answers
925
views
Restrict WordPress Media Library for a specific user role (users can only see/select own media)
I have 4 roles in my platform : administrator, author, editor, external
I need to restrict WordPress media library access to the user’s own uploads only for one users role (external) on my platform. ...
1
vote
2
answers
54
views
Automatically assign video 'poster' value to 'filename' for archive listing
One of my sites is used as a personal diary with >5000 videos uploaded within the media library.
Each post uses the following shortcode, disabling pre-load and assigning a manual poster. This ...
1
vote
0
answers
180
views
Display attachments by the ID of the post being edited in the wp.media frame (frontend)
There is a button in the frontend on the post page to upload images. How do I display attachments that are attached to this post in the wp.media frame? How to intercept wp.media's AJAX request for ...
1
vote
0
answers
501
views
How select multiple document as like media gallery
I want to make a document(.pdf) gallery with multiple selections exactly like the image gallery. So that when I click on a button or something wp.media selection frame will be popup and can select ...
1
vote
0
answers
63
views
Rebuild the entire WordPress uploads folder
I have an unfortunate situation in which a client disabled "Organize my uploads into month- and year-based folders" which is what organizes files into a {year/month} folder hierarchy on the ...
1
vote
0
answers
34
views
Uppload image from another source wp.media
I am writing an extension that will load images from third party sources and embed that image in WP media library.
I cannot figure out how to manage wp.media to load such images.
How it will work.
...
1
vote
0
answers
25
views
Media Gallery Upload photo incorrect way like glitch
I start having this issue like 3 days ago, I disable all plugins but nothing works.
See the examples:
Original photo:
after I upload:
1
vote
0
answers
27
views
Restrict media upload size by format
I'm looking for a way to restrict the size of the media when uploading (a plugin or just a function).
So I found this:
function increase_upload_size_limit( $limit ) {
return 524288;
}
add_filter( '...
1
vote
0
answers
166
views
media_handle_upload() progress bar
I'm using the media_handle_upload() function to upload several type of file in the media section of Wordpress Backend.
Is there an easy way to have a progress bar linked to this function to give some ...