How to re-house images in uploads/YYYY/MM

My media items are not stored in YYYY/MM subfolders of uploads. Instead, I had cooked up some scheme to ingest posts, but seem to have declined/neglected to organise them that way. So, I've got a combination of one big uploads folder containing thousands of files, plus some specific subfolders in uploads, like logos, people, icons. That's because not everything is related to a post. But the images that do relate to posts... well, they are disorganised. I think I wish …
Category: Web

Media library on another server?

I have been searching for a solution to have my media library on another server but i haven't figured out any good solution yet. I don't know if this is possible so let me know if i'm lost here :) Anyway, our setup right now is pretty straight forward, we have a domain and a subdomain, both on a shared hosting. Due to performance issues, we are going to transfer our site to a VPS, but to make the transfer …
Category: Web

Media Library is not loading on grid view in admin panel

Media Library is not loading on grid view and also featured image not select any image from post and page . The progress circle keeps spinning. Due to this issue, I am not able to add any image in the post as insert image option also opens in “grid view” by default. The things I tried but not resolved my issue: Removed all plugins. Switch to twenty sixteen theme. Deleted whole wordpress installation. Installed fresh. Enabled script debug.Doesn’t show any …
Category: Web

How to create different media uploader frames / filter library depending on a custom action

Here is the thing. I am using the WP media uploader on the frontend. What I need is to have it behave differently depending on a certain action. I am attaching the media in a specific custom post type single page. This is a small excerpt from my code. I'm using this to trigger the media library. var uploader = wp.media({ title: 'Upload Image', multiple: false }).open() .on('select', function(e){ // Some code here }); Then I am filtering the library …
Category: Web

Multiple domains using same WordPress, set specific uploads folder

For a project at my office I have 3 websites ending in ".nl", ".de" and ".com". They all end in the same folder but don't all have the same images and uploads. My folder structure is like this: - / | - wordpress | - wp-content | - uploads | - themes | - plugins | - index.php | - wp-config.php Everything was working fine until I changed the uploads directory for the uploads with this line: const UPLOADS = …
Category: Web

Disable Media Uploads to 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 media manager/upload screen below, is it possible to make the Upload Files tab to only be visible to Admin Users and also to make the Media Library shown by Default when this Dialog is shown?
Category: Web

Multisite: use media from one site vs. copying the same media to all language sites?

This is a business site with product images. I have a multisite installation with 3 languages in 3 directories which will later be mapped to completely separate domains by the host when it's finished. The media (EDIT: in one of the sites) currently consists almost completely of large images (EDIT: total 1.8GB) that are not language-dependent, and editors will need to add the same images when creating pages with the texts in their language. However, their media library is currently …
Category: Web

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 the Wordpress API? The image is a setting in the plugin (only changable by the admin)
Category: Web

WooCommerce CSV Image URL Creates Additional Images in Media Folder

I upload all images through the Media Library Drag and Drop Uploader with no problems. Every time I use a CSV file with several thousand products, I enter the image url for each product, which is located in the Media Library. Example: /wp-content/uploads/2018/08/oa901-essence-1oz.jpg As a result, the product page uses the image with the added -1 instead of the original or even a thumbnail of the original. Then when I download all of the products, the image url has the …
Category: Web

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 library'-tab after I uploaded/ wordpress finished crunching the file. So basically i'm looking for a hook that's fired after the crunching of an uploaded file is finished. I can't imagine this would be such an extreme thing but I can't seem to find the right hook for …
Category: Web

Insert wp gallery shortcode into custom textarea

Is there a way to insert wp gallery shortcode into custom metabox textarea ? I would like to have something like this: New metabox in post/page with textarea and below textarea there are a button to open wp browse media gallery lightbox. then when we have done to select few images as gallery, click the "insert gallery" button will insert the shortcode to the textarea custom field. is it possible ? Thanks ====== Update: ====== I was able to show …
Category: Web

Share media among different domains

I have multiple Wordpress instances that live on separate domains (not a multisite installation). Since they provide the same content in different languages I'd like to share the images among these instances. Ideally these Wordpress installations would share the same Media Library so that I have to upload the files only once and they would be available on the other site as well, even served by the same CDN and sharing the same URL. So for example I upload Image1.jpg …
Category: Web

Use custom image size in admin panel

I have add some image size like: add_image_size( 'custom-small', 600, 600 ); add_image_size( 'custom-medium', 1280, 1280 ); add_image_size( 'custom-large', 2560, 2560 ); and I have removed all the default sizes. Now the Media Library in the Admin panel is loading full image instead of medium. Is it possible to specify a custom size to use?
Category: Web

Removing delete permanently button in uploading files media

How do I delete or remove the word Delete Permanently in uploading files? I wanted to remove this permanently so that the users won't keep deleting files which are not supposed to delete. I use this code: .button-link.delete-attachment{display:none} But the problem of this, if the user uses the inspect element, they can just change it to display:block to show the delete button. Using CSS is not an option. Is there a function code here to remove this? Or where can …
Category: Web

Update media library image shown in "attachment details" when using wp_insert_attachment to add item to the media library

I'm using the function wp_insert_attachment() to run on a form submission from GravityForms, take a file uploaded in the form, and add it to the WordPress Media Library. Code in functions.php below, also in Github: function form_to_media_library($entry){ // from https://developer.wordpress.org/reference/functions/wp_insert_attachment/#div-comment-948 // set filename $upload_path = GFFormsModel::get_upload_path( $entry[ 'form_id' ] ); $upload_url = GFFormsModel::get_upload_url( $entry[ 'form_id' ] ); $filename_verbose = str_replace( $upload_url, $upload_path, $entry[ '1' ] ); $filename = trim($filename_verbose, ' "[]\ '); // check the type of file. We'll use …
Category: Web

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.jpg first-image-name-150x150.jpg first-image-name-250x250.jpg first-image-name-300x300.jpg first-image-name-400x400.jpg first-image-name-1024x1024.jpg second-image-name.jpg second-image-name-72x72.jpg second-image-name-150x150.jpg second-image-name-250x250.jpg second-image-name-300x300.jpg second-image-name-400x400.jpg second-image-name-1024x1024.jpg Is there a way to delete all the resized images and disable creating such ones in the future?
Category: Web

Remove duplicate media entries from mysql database

I am wondering if you can help. I have a wordpress site with 90000 media entries, but only 1000 images. I do not want to remove the images from the media gallery just the entries in the database that have been duplicated. I know that you can find the duplicates in the wordpress admin area using a plugin however they delete all the images rather than just the duplicated database entries. SELECT posts.ID, posts.post_title AS title, posts.post_content AS content, files.meta_value …
Category: Web

images inside wp-content/ uploads/ are not showing up in my media library and uploaded using FTP protocol

Hello would anybody be able to help my situation? at this point I'm wondering if it is a database issue because when i try the alternative to drag and drop an image into my media library i get this error-" could not insert post into the database". the hello? i have the permissions set up correct upload folder set to 744 as are the inner folders, the files set to 644. also have set my wp-config.php file to direct to …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.