Exemplo n.º 1
0
 /**
  * Resize an image using DSLC_Aq_Resize Class
  *
  * @since 1.0
  *
  * @param string $url     The URL of the image
  * @param int    $width   The new width of the image
  * @param int    $height  The new height of the image
  * @param bool   $crop    To crop or not to crop, the question is now
  * @param bool   $single  If true only returns the URL, if false returns array
  * @param bool   $upscale If image not big enough for new size should it upscale
  * @return mixed If $single is true return new image URL, if it is false return array
  *               Array contains 0 = URL, 1 = width, 2 = height
  */
 function dslc_aq_resize($url, $width = null, $height = null, $crop = null, $single = true, $upscale = false)
 {
     if (class_exists('Jetpack') && Jetpack::is_module_active('photon')) {
         $args = array('resize' => "{$width},{$height}");
         if ($single == true) {
             return jetpack_photon_url($url, $args);
         } else {
             $image = array(0 => $img_url, 1 => $width, 2 => $height);
             return jetpack_photon_url($url, $args);
         }
     } else {
         $aq_resize = DSLC_Aq_Resize::getInstance();
         return $aq_resize->process($url, $width, $height, $crop, $single, $upscale);
     }
 }
 /**
  * Resize an image using DSLC_Aq_Resize Class
  *
  * @since 1.0
  *
  * @param string $url     The URL of the image
  * @param int    $width   The new width of the image
  * @param int    $height  The new height of the image
  * @param bool   $crop    To crop or not to crop, the question is now
  * @param bool   $single  If true only returns the URL, if false returns array
  * @param bool   $upscale If image not big enough for new size should it upscale
  * @return mixed If $single is true return new image URL, if it is false return array
  *               Array contains 0 = URL, 1 = width, 2 = height
  */
 function dslc_aq_resize($url, $width = null, $height = null, $crop = null, $single = true, $upscale = false)
 {
     $aq_resize = DSLC_Aq_Resize::getInstance();
     return $aq_resize->process($url, $width, $height, $crop, $single, $upscale);
 }