Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Possible Duplicate:
Prevent Width and Height Attributes in Image Tag Output

i would like to remove the width="512" height="128" attributes on an attachments

this method is fine on images displayed in the_content : Filter to remove image dimension attributes?

but i can't find a way to make it work on an attachement i call outside of the_content with wp_get_attachment_image.

how can i do this ?

share|improve this question

marked as duplicate by toscho Jul 2 '12 at 0:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
just found the solution ! $myimage = preg_replace( '/(width|height)=\"\d*\"\s/', "", wp_get_attachment_image($first_attachment->ID, full) ); echo $myimage; –  user9446 Oct 14 '11 at 23:10
add comment

1 Answer 1

wp_get_attachment_image() does not pass output through any filters. You should apply changes to output of this function or use custom function for output.

share|improve this answer
    
There's a filter inside wp_get_attachment_image though, named .. wp_get_attachment_image_attributes, perhaps you could catch the size there? Not sure who downvoted this answer, curious to know the reasoning.. –  Mark Duncan Oct 15 '11 at 17:01
    
@Mark filtered attributes are additional ones, width and height are retrieved and concatenated separately and do not pass through that filter. –  Rarst Oct 15 '11 at 17:47
add comment