homepagePHP/app/Common/Lib/ImageSize.class.php

86 lines
2.2 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Common\Lib;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
class ImageSize {
private static $_unit = 'px';
private static $_attr = [
// "default" => [250,250],
// 轮播图
"pc_index_banner" => [1920,600],
"m_index_banner" => [750,460,100],
"en_pc_banner" => [1920,400],
"en_mobile_banner" => [750,467,100],
"pc_banner_image" => [1920,320],
"m_banner_image" => [750,300],
// 关于心和-首页
"index_about_logo" => [206,40],
"pc_index_about"=>[528,300],
"m_index_about"=>[690,360],
//关于心和-模块
'about_top'=>[940,280],
'about_news'=>[320,180],
'about_pic'=>[266,188],
'about_people'=>[170,180],
'about_event'=>[320,200],
//三大项目
'project_news'=>[290,220],
'research_news'=>[],
//行业支持
'support'=>[320,180],
'm_support'=>[240,201],
//核心项目
"index_project"=>[370,208],
"m_index_project"=>[291,304],
//信息公开
"info_news"=>[320,180],
'm_info_news'=>[240,201],
"info_report"=>[206,280],
//新闻动态
'pc_index_news'=>[366,258],
'm_index_news'=>[254,220],
//其他项目
"project" => [366, 258],
];
public static function getIpOption($name){
// if ($name === null) {
// $name = 'default';
// }
if (!isset(self::$_attr[$name])){
return $name;
}
$value = self::$_attr[$name][0].'x'.self::$_attr[$name][1];
if (isset(self::$_attr[$name][2])){
$value.=',q'.self::$_attr[$name][2];
}
return $value;
}
public static function AdminTips($name){
if (!isset(self::$_attr[$name])){
$name = 'default';
}
return '尺寸为'.self::$_attr[$name][0].'x'.self::$_attr[$name][1].self::$_unit.',请上传jpg,gif,png,jpeg格式大小不超过10MB';
}
}