function uihelper_resize_img($picture, $max_x, $max_y, $alternate = NULL, $extra_attrs = 'alt="PA"', $opts = RESIZE_CROP) { global $path_prefix, $base_url; $ret = ImageResize::resize_img("{$path_prefix}/web", $base_url, "files/rsz", $max_x, $max_y, $picture, $alternate, FALSE, $opts); $ret['url'] = $base_url . '/' . $ret['final_path']; return $ret; }
function uihelper_resize_img($pic, $max_x, $max_y, $alternate = NULL, $extra_attrs = 'alt="PA"', $opts = RESIZE_CROP) { $ret = ImageResize::resize_img("web", PA::$url, "files/rsz", $max_x, $max_y, uihelper_preprocess_pic_path($pic), $alternate, FALSE, $opts); if (!isset($ret['url'])) { $ret['url'] = PA::$url . '/' . $ret['final_path']; } return $ret; }
public static function resize_mk_img($root_path, $root_url, $output_path, $max_x, $max_y, $picture, $alternate = NULL, $overwrite = FALSE, $extra_attrs = "", $resize_type = RESIZE_CROP) { $info = ImageResize::resize_img($root_path, $root_url, $output_path, $max_x, $max_y, $picture, $alternate, $overwrite, $resize_type); if (!$picture instanceof StoredFile) { if (!file_exists($info['final_path'])) { $info = NULL; // For Animated Gif files Only ImageResize::create_frame_from_animated_pic($root_path, $picture, $output_path, $max_x, $max_y); $info = ImageResize::resize_img($root_path, $root_url, $output_path, $max_x, $max_y, $picture, $alternate, $overwrite, $resize_type); } $info['url'] = "{$root_url}/" . $info['final_path']; } if ($extra_attrs) { $img = "<img {$extra_attrs}"; } else { $img = "<img"; } return $img . ' border="0" src="' . htmlspecialchars($info['url']) . '" ' . $info['size_attr'] . '/>'; }
function api_resize_user_image($picture, $imageWidth, $imageHeight) { $picture = trim($picture); if (empty($picture)) { return NULL; } // ripped off from web/includes/image_resize.php (uihelper_preprocess_pic_path) if (defined("NEW_STORAGE") && preg_match("|^pa://|", $picture)) { $picture = Storage::get($picture); } else { $picture = "files/{$picture}"; if (!file_exists(PA::$project_dir . "/web/{$picture}") && !file_exists(PA::$core_dir . "/web/{$picture}")) { return NULL; } } if ($imageWidth) { // scale image down $im_info = ImageResize::resize_img("web", PA::$url, "files/rsz", $imageWidth, $imageHeight, $picture); } else { $im_size = @getimagesize(Storage::getPath($picture)); $im_info = array('url' => Storage::getURL($picture), 'width' => $im_size[0], 'height' => $im_size[1]); } return array('url' => $im_info['url'], 'height' => (int) $im_info['height'], 'width' => (int) $im_info['width']); }
function api_resize_user_image($picture, $imageWidth, $imageHeight) { global $path_prefix, $base_url; if (empty($picture)) { return NULL; } $img_path = "files/{$picture}"; if (!file_exists("{$path_prefix}/web/{$img_path}")) { return NULL; } if ($imageWidth) { // scale image down $im_info = ImageResize::resize_img("{$path_prefix}/web", $base_url, "files/rsz", $imageWidth, $imageHeight, $img_path); } else { $im_size = @getimagesize("{$path_prefix}/web/{$img_path}"); $im_info = array('final_path' => $img_path, 'width' => $im_size[0], 'height' => $im_size[1]); } return array('url' => "{$base_url}/" . $im_info['final_path'], 'height' => $im_info['height'], 'width' => $im_info['width']); }