Articles of uploads

is it possible to force wordpress to always save thumbnails as 'jpg' not 'png'

I cant see any settings and cant see much in the php api docs regarding this? for instance if the original file upload is a png wordpress converts to jpg

How to hide CPT files from media library programmatically

We have created a CPT which allows our customer to upload files from the admin page to a folder outside of the wp-content/uploads folder. Files are uploaded and manipulated using wp_handle_upload and wp_insert_attachment. How do we prevent these files from showing in the media library? Can we filter by post type? Thanks in advance for […]

Limit upload by file type only for certain custom post type

I have created a custom post type called “pdf”. I’ve have a custom metabox where user can upload a pdf file throught wordpress builtin media uploader I need to restrict allowed files (pdf) only in this uploader. I already know how to restrict allowed files: How to set file type in wp_handle_upload? but the link […]

How can I reduce file upload size?

The current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution. But why isn’t there a method for doing this in the functions.php file? ** UPDATE ** So this, over at […]

Disable resizing of gif when uploaded

Animated gifs are getting more popular on the web (again) and currently there is no good tool for resizing animated gifs. So I want to disable resizing/generation of image sizes for the gif mimetype and just save the original gif. Someone that can help me out with this? Which filter to use will be a […]

Site icons with alpha channel for self-hosted WordPress blog network

Either I’m missing something (or have something badly configured in my self-hosted blog network) or when I’m uploading a transparent .png file (with alpha channel) using Media Library, my WordPress installation makes all possible cropped versions loosing transparency. This way, when I’m picking a perfectly transparent image for my site icon, I end up with […]

Create Image Uploader for Widget

I found this post// Use Media upload in custom widget on wordpress 3.5 I’m not experienced in any of this so I pretty much just copied the code he provided into my own functions.php file. I uploaded the JS and everything… I then replaced certain code that “sven” posted in his answer. The uploader works […]

Quickest Way Besides FTP to Upload WordPress Files to a Web Server?

Assume I have SSH from a shared/managed-VPS hosting, and FTP access, but no fantastico. Thanks.

Conditional add_filter for upload directory?

I have a custom media upload button (in the standard post edit page, alongside the standard media upload button), and need to change the upload directory dynamically if this button is clicked – using add_filter(‘wp_handle_upload_prefilter’, ‘my_function’). This post & answer: Conditional add_filter? seem to give the solution, but for some reason don’t work for me […]

wp_handle_upload – The uploaded file could not be moved to wp-content/uploads/2012/09

This is the code I am using to upload the file to WordPress define(‘WP_DEBUG’, true); $filename = “test.png”; $tmpFile = download_url(“”.$filename); chmod($tmpFile, 0755); $mimeType = wp_check_filetype($_SERVER[‘DOCUMENT_ROOT’] . ‘/testing/crop/’.$filename); $file_array = array( ‘file’ => $_SERVER[‘DOCUMENT_ROOT’] . ‘/testing/crop/’.$filename, ‘url’ => $_SERVER[‘DOCUMENT_ROOT’] . ‘/testing/crop/’.$filename, ‘type’ => $mimeType[‘type’], ‘size’ => filesize($_SERVER[‘DOCUMENT_ROOT’] . ‘/testing/crop/’.$filename), ‘name’ => $filename, ‘tmp_name’ => $tmpFile […]