本文整理汇总了PHP中CUtil::TPL_DISP_IMAGE方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtil::TPL_DISP_IMAGE方法的具体用法?PHP CUtil::TPL_DISP_IMAGE怎么用?PHP CUtil::TPL_DISP_IMAGE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtil
的用法示例。
在下文中一共展示了CUtil::TPL_DISP_IMAGE方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserPersonalImage
public static function getUserPersonalImage($user_id, $image_size = "small", $cache = true)
{
//if(isset(self::$u_image[$user_id]))
// return self::$u_image[$user_id];
$image_exists = false;
$image_details = array();
$user_imageInfo = UserImage::whereRaw('user_id = ? ', array($user_id))->first();
if (count($user_imageInfo) > 0) {
$image_exists = true;
$image_details["image_id"] = $user_imageInfo->image_id;
$image_details["image_ext"] = $user_imageInfo->image_ext;
$image_details["image_name"] = $user_imageInfo->image_name;
$image_details["image_server_url"] = $user_imageInfo->image_server_url;
$image_details["image_large_width"] = $user_imageInfo->large_width;
$image_details["image_large_height"] = $user_imageInfo->large_height;
$image_details["image_small_width"] = $user_imageInfo->small_width;
$image_details["image_small_height"] = $user_imageInfo->small_height;
$image_details["image_thumb_width"] = $user_imageInfo->thumb_width;
$image_details["image_thumb_height"] = $user_imageInfo->thumb_height;
$image_details["image_folder"] = Config::get("generalConfig.user_image_folder");
}
$image_path = "";
$image_url = "";
$image_attr = "";
if ($image_exists) {
$image_path = URL::asset(Config::get("generalConfig.user_image_folder")) . "/";
}
$cfg_user_img_large_width = Config::get("user_image_large_width");
$cfg_user_img_large_height = Config::get("user_image_large_height");
$cfg_user_img_thumb_width = Config::get("user_image_thumb_width");
$cfg_user_img_thumb_height = Config::get("user_image_thumb_height");
$cfg_user_img_small_width = Config::get("user_image_small_width");
$cfg_user_img_small_height = Config::get("user_image_small_height");
switch ($image_size) {
case 'large':
$image_url = URL::asset("packages/agriya/webshoppack/images/no_image") . '/userno-180.jpg';
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_large_width, $cfg_user_img_large_height, $cfg_user_img_large_width, $cfg_user_img_large_height);
if ($image_exists) {
$image_url = $image_path . $image_details["image_name"] . "_L." . $image_details["image_ext"];
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_large_width, $cfg_user_img_large_height, $image_details["image_large_width"], $image_details["image_large_height"]);
}
break;
case "thumb":
$image_url = URL::asset("packages/agriya/webshoppack/images/no_image") . '/userno-62.jpg';
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_thumb_width, $cfg_user_img_thumb_height, $cfg_user_img_thumb_width, $cfg_user_img_thumb_height);
if ($image_exists) {
$image_url = $image_path . $image_details["image_name"] . "_T." . $image_details["image_ext"];
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_thumb_width, $cfg_user_img_thumb_height, $image_details["image_thumb_width"], $image_details["image_thumb_height"]);
}
break;
case "small":
$image_url = URL::asset("packages/agriya/webshoppack/images/no_image") . '/userno-30.jpg';
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_small_width, $cfg_user_img_small_height, $cfg_user_img_small_width, $cfg_user_img_small_height);
if ($image_exists) {
$image_url = $image_path . $image_details["image_name"] . "_S." . $image_details["image_ext"];
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_small_width, $cfg_user_img_small_height, $image_details["image_small_width"], $image_details["image_small_height"]);
}
break;
default:
$image_url = URL::asset("packages/agriya/webshoppack/images/no_image") . '/userno-62.jpg';
$image_attr = CUtil::TPL_DISP_IMAGE(52, 52, 62, 62);
if ($image_exists) {
$image_url = $image_path . $image_details["image_name"] . "_T." . $image_details["image_ext"];
$image_attr = CUtil::TPL_DISP_IMAGE(52, 52, $image_details["image_thumb_width"], $image_details["image_thumb_height"]);
}
}
$image_details['image_url'] = $image_url;
$image_details['image_attr'] = $image_attr;
self::$u_image[$user_id] = $image_details;
return self::$u_image[$user_id];
}
示例2: getProductDefaultThumbImage
public static function getProductDefaultThumbImage($p_id, $image_size = "thumb", $p_image_info = array())
{
$image_exists = false;
$image_details = array();
$image_title = trans('webshoppack::product.no_image');
$no_image = true;
if (count($p_image_info) > 0 && $image_size == "thumb" && isset($p_image_info['thumbnail_img']) && $p_image_info['thumbnail_img'] != '') {
$image_exists = true;
$image_details["thumbnail_img"] = $p_image_info->thumbnail_img;
$image_details["thumbnail_ext"] = $p_image_info->thumbnail_ext;
$image_details["thumbnail_width"] = $p_image_info->thumbnail_width;
$image_details["thumbnail_height"] = $p_image_info->thumbnail_height;
$image_details["thumbnail_title"] = $p_image_info->thumbnail_title;
$image_details["image_folder"] = \Config::get("webshoppack::photos_folder");
}
if (count($p_image_info) > 0 && $image_size == "default" && isset($p_image_info['default_img']) && $p_image_info['default_img'] != '') {
$image_exists = true;
$image_details["default_img"] = $p_image_info->default_img;
$image_details["default_ext"] = $p_image_info->default_ext;
$image_details["default_width"] = $p_image_info->default_width;
$image_details["default_height"] = $p_image_info->default_height;
$image_details["default_title"] = $p_image_info->default_title;
$image_details["image_folder"] = \Config::get("webshoppack::photos_folder");
}
if (count($p_image_info) > 0 && $image_size == "indexsmall" && isset($p_image_info['default_img']) && $p_image_info['default_img'] != '') {
$image_exists = true;
$image_details["thumbnail_img"] = $p_image_info->thumbnail_img;
$image_details["thumbnail_ext"] = $p_image_info->thumbnail_ext;
$image_details["thumbnail_width"] = $p_image_info->thumbnail_width;
$image_details["thumbnail_height"] = $p_image_info->thumbnail_height;
$image_details["thumbnail_title"] = $p_image_info->thumbnail_title;
$image_details["image_folder"] = \Config::get("webshoppack::photos_folder");
}
$image_path = "";
$image_url = "";
$image_attr = "";
if ($image_exists) {
$image_path = \URL::asset(\Config::get("webshoppack::photos_folder")) . "/";
}
$cfg_user_img_large_width = \Config::get("webshoppack::photos_large_width");
$cfg_user_img_large_height = \Config::get("webshoppack::photos_large_height");
$cfg_user_img_thumb_width = \Config::get("webshoppack::photos_thumb_width");
$cfg_user_img_thumb_height = \Config::get("webshoppack::photos_thumb_height");
$cfg_user_img_indexsmall_width = \Config::get("webshoppack::photos_indexsmall_width");
$cfg_user_img_indexsmall_height = \Config::get("webshoppack::photos_indexsmall_height");
switch ($image_size) {
case 'default':
$image_url = \URL::asset("packages/agriya/webshoppack/images/no_image") . '/' . \Config::get("webshoppack::photos_large_no_image");
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_large_width, $cfg_user_img_large_height, $cfg_user_img_large_width, $cfg_user_img_large_height);
if ($image_exists) {
$image_url = $image_path . $image_details["default_img"] . "L." . $image_details["default_ext"];
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_large_width, $cfg_user_img_large_height, $image_details["default_width"], $image_details["default_height"]);
$image_title = $image_details["default_title"];
$no_image = false;
}
break;
case "thumb":
$image_url = \URL::asset("packages/agriya/webshoppack/images/no_image") . '/' . \Config::get("webshoppack::photos_thumb_no_image");
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_thumb_width, $cfg_user_img_thumb_height, $cfg_user_img_thumb_width, $cfg_user_img_thumb_height);
if ($image_exists) {
$image_url = $image_path . $image_details["thumbnail_img"] . "T." . $image_details["thumbnail_ext"];
//$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_thumb_width, $cfg_user_img_thumb_height, $image_details["thumbnail_width"], $image_details["thumbnail_height"]);
$image_title = $image_details["thumbnail_title"];
$no_image = false;
}
break;
case "indexsmall":
$image_url = \URL::asset("packages/agriya/webshoppack/images/no_image") . '/' . \Config::get("webshoppack::photos_indexsmall_no_image");
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_indexsmall_width, $cfg_user_img_indexsmall_height, $cfg_user_img_indexsmall_width, $cfg_user_img_indexsmall_height);
if ($image_exists) {
$image_url = $image_path . $image_details["thumbnail_img"] . "IS." . $image_details["thumbnail_ext"];
$image_attr = CUtil::TPL_DISP_IMAGE($cfg_user_img_indexsmall_width, $cfg_user_img_indexsmall_height, $cfg_user_img_indexsmall_width, $cfg_user_img_indexsmall_height);
$image_title = $image_details["thumbnail_title"];
$no_image = false;
}
break;
default:
$image_url = \URL::asset("packages/agriya/webshoppack/images/no_image") . '/product-thumb-170.jpg';
$image_attr = CUtil::TPL_DISP_IMAGE(170, 150, 170, 150);
if ($image_exists) {
$image_url = $image_path . $image_details["thumbnail_img"] . "T." . $image_details["thumbnail_ext"];
$image_attr = CUtil::TPL_DISP_IMAGE(170, 150, $image_details["image_thumb_width"], $image_details["image_thumb_height"]);
$image_title = $image_details["thumbnail_title"];
$no_image = false;
}
}
$image_details['image_url'] = $image_url;
$image_details['image_attr'] = $image_attr;
$image_details['title'] = $image_title;
$image_details['no_image'] = $no_image;
return $image_details;
}