Exemplo n.º 1
0
 public static function load($old_image = '', $args = null)
 {
     $new_image = false;
     if (isset($args['fancybox']) && $args['fancybox']) {
         unset($args['fancybox']);
     }
     $args = self::process_defaults($args);
     $disable_dragonfly = pls_get_option('pls-disable-dragonfly');
     // use standard default image
     if ($old_image === '' || empty($old_image)) {
         if (!empty($args['null_image'])) {
             $old_image = $args['null_image'];
         } else {
             $old_image = PLS_IMG_URL . "/null/listing-1200x720.jpg";
         }
     } elseif ($args['allow_resize'] && $args['resize']['w'] && $args['resize']['h'] && get_theme_support('pls-dragonfly') && $disable_dragonfly != true) {
         $img_args = array('resize' => $args['resize'], 'old_image' => $old_image);
         $new_image = PLS_Plugin_API::resize_image($img_args);
     }
     if ($args['fancybox'] || $args['as_html']) {
         if ($new_image) {
             $new_image = self::as_html($old_image, $new_image, $args);
         } else {
             $new_image = self::as_html($old_image, null, $args);
         }
     }
     // return the new image if we've managed to create one
     if ($new_image) {
         return $new_image;
     } else {
         return $old_image;
     }
 }