[wp-trac] [WordPress Trac] #20358: Filter image_hwstring()

WordPress Trac noreply at wordpress.org
Mon Mar 3 09:26:51 UTC 2014


#20358: Filter image_hwstring()
--------------------------+------------------------
 Reporter:  wpsmith       |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Media         |     Version:
 Severity:  normal        |  Resolution:  duplicate
 Keywords:                |     Focuses:
--------------------------+------------------------
Description changed by SergeyBiryukov:

Old description:

> Make it possible to remove width and height from media HTML output
> functions by filtering image_hwstring(). This is perfect for
> responsiveness.
>
> This can be done a few different ways:
>
> {{{
> function image_hwstring($width, $height) {
>         $out = '';
>         if ($width)
>                 $out .= 'width="'.intval($width).'" ';
>         if ($height)
>                 $out .= 'height="'.intval($height).'" ';
>         return apply_filters( 'image_hwstring', $out );
> }
> }}}
>
> This could be easily filtered by something like:
> add_filter( 'image_hwstring', '__return_empty_string' );
>
> See #20357.

New description:

 Make it possible to remove width and height from media HTML output
 functions by filtering image_hwstring(). This is perfect for
 responsiveness.

 This can be done a few different ways:

 {{{
 function image_hwstring($width, $height) {
         $out = '';
         if ($width)
                 $out .= 'width="'.intval($width).'" ';
         if ($height)
                 $out .= 'height="'.intval($height).'" ';
         return apply_filters( 'image_hwstring', $out );
 }
 }}}

 This could be easily filtered by something like:
 {{{
 add_filter( 'image_hwstring', '__return_empty_string' );
 }}}

 See #20357.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/20358#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list