Posts Tagged ‘hacks’

Removing Width/Height from the Image Uploader


Reader Vivien writes in: Is there a way to prevent WordPress from inserting the width and the height for images in the new 2.5 media manager? In short, yes, but it requires you to insert some code into your theme’s functions.php file. Fortunately, there is a WordPress filter we can use called image_downsize, which takes in three arguments (a boolean, an attachment ID, and a size string). add_filter('image_downsize', 'my_image_downsize',1,3); All I’m doing in the above filter is setting the filter name, the function to call (my_image_downsize), what priority I want the filter, and how many arguments the function takes. From there, I mimic the function image_downsize in the ‘wp-includes/media.php’ file, but do not return a width or a height. As a result, when the image is sent to the editor, no width or height is present. function my_image_downsize($value = false,$id = 0, $size = "medium") { if ( !wp_attachment_is_image($id) ) […]

[Continue Reading...]

Obviously Powered by WordPress. © 2003-2013

page counter