[wp-hackers] Need direction on custom image handling

scribu scribu at gmail.com
Wed Feb 11 13:44:53 GMT 2009


This is how I check if an image is large enough:

add_filter('wp_update_attachment_metadata', 'check_size', 10, 2);

function check_size($data, $id) {
        if ( $data['width'] < 800 && $data['height'] < 600 ) {
            wp_delete_attachment($id);
            die("<strong class='error'>Eroare: Imaginea este prea
mică</strong>");
        } else
            return $data;
}

You could also try the 'add_attachment' hook.

-- 
http://scribu.net


More information about the wp-hackers mailing list