[wp-hackers] Set a unique directory for uploads
Gaarai
gaarai at gaarai.com
Fri Jan 16 04:45:28 GMT 2009
There isn't a direct way to remove these additional images. However,
there is a filter that you can hook into in order to clear out the array
that stores the possible sizes. That filter is intermediate_image_sizes.
This filter is used in the wp_generate_attachment_metadata() function
inside wp-admin/includes/image.php. By default, this filter passes along
an array, $sizes, with the following definition:
$sizes = array('thumbnail', 'medium', 'large');
After this array is filtered, it is gone through one item at a time in
order to generate the resized images. You could simply hook into the
intermediate_image_sizes filter and return an empty array:
add_filter( 'intermediate_image_sizes', 'remove_intermediate_image_sizes' );
function remove_intermediate_image_sizes( $sizes ) {
return array();
}
This could simply be added to your functions.php file in the theme. I
tested it this way, and it worked perfectly.
However, you should note that if you do this, every place WordPress uses
the thumbnail, the complete image will be used instead. This means that
if you load up the Media Library page, every image shown on that library
page will be downloaded and shown. This may or may not be a problem for
you, but you should be aware of it.
It should also be noted that this does not make the Thumbnail, Medium,
and Large options disappear from the "Add an image" media uploader. It
simply disables their radio buttons.
Chris Jean
http://gaarai.com/
http://wp-roadmap.com/
Mário Gamito wrote:
> Mário Gamito wrote:
>
>> Hi,
>>
>
>
>> How can I make my images and file being uploaded to
>> /home/user/public_html/attic only ?
>>
> Ok, I've found the answer, but another thing: I upload an image and in
> the "attic" directory it creates another two scaled down versions of the
> image.
>
> I went to Settings/Media, but I see no option to WP not create these 2
> images.
>
> Is it possible in some way to do this ?
>
> Any help would be appreciated.
>
> Warm Regards,
>
More information about the wp-hackers
mailing list