Skip to content

Commit

Permalink
Widgets - Image: make routines for photonization similar to those to …
Browse files Browse the repository at this point in the history
…enable support in Text widget
  • Loading branch information
eliorivero authored and dereksmart committed Mar 14, 2017
1 parent d11f637 commit 41c07fd
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions modules/widgets/image-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,7 @@ public function widget( $args, $instance ) {

if ( '' != $instance['img_url'] ) {

$image_url = Jetpack::is_module_active( 'photon' )
? jetpack_photon_url( $instance['img_url'], array(
'w' => $instance['img_width'],
'h' => $instance['img_height'],
) )
: $instance['img_url'];

$output = '<img src="' . esc_url( $image_url ) . '" ';
$output = '<img src="' . esc_url( $instance['img_url'] ) . '" ';

if ( '' != $instance['alt_text'] ) {
$output .= 'alt="' . esc_attr( $instance['alt_text'] ) .'" ';
Expand All @@ -94,6 +87,11 @@ public function widget( $args, $instance ) {
$output .= 'height="' . esc_attr( $instance['img_height'] ) .'" ';
}
$output .= '/>';

if ( class_exists( 'Jetpack_Photon' ) && Jetpack::is_module_active( 'photon' ) ) {
$output = Jetpack_Photon::filter_the_content( $output );
}

if ( '' != $instance['link'] ) {
$target = ! empty( $instance['link_target_blank'] )
? 'target="_blank"'
Expand Down

0 comments on commit 41c07fd

Please sign in to comment.