本文整理汇总了PHP中category::getheightofthumb方法的典型用法代码示例。如果您正苦于以下问题:PHP category::getheightofthumb方法的具体用法?PHP category::getheightofthumb怎么用?PHP category::getheightofthumb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类category
的用法示例。
在下文中一共展示了category::getheightofthumb方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload_thumb_action
function upload_thumb_action() {
$res=array();
$uploads=array();
if (is_array($_FILES)) {
$upload=new upload();
foreach ($_FILES as $name=>$file) {
if (!$file['name'] ||!preg_match('/\.(jpg|gif|png|bmp)$/',$file['name'])) {
continue;
}
$uploads[$name]=$upload->run($file);
if (empty($uploads[$name])) {
$res['error']=$name.lang('上传失败!');
break;
}
$res[$name]['name']=$uploads[$name];
$path=$upload->save_path;
chmod($path,0644);
$thumb=new thumb();
$thumb->set($path,'file');
$catid=get('catid');
$type=get('type');
if ($catid)
$thumb->create($path,category::getwidthofthumb($catid),category::getheightofthumb($catid));
else
$thumb->create($path,config::get('thumb_width'),config::get('thumb_height'));
$_name=str_replace('_upload','',$name);
$res[$name]['code']="
document.form1.$_name.value=data[key].name;
image_preview('$_name',data[key].name);
";
}
}
echo json::encode($res);
}
示例2: save_before
function save_before() {
parent::save_before();
front::$post['content'] = htmlspecialchars_decode(front::$post['content']);
if(front::$post['htmlrule1'] != ''){
front::$post['htmlrule'] = front::$post['htmlrule1'];
}
front::$post['strong'] = intval(front::$post['strong']);
$pics = array();
foreach(front::$post as $k =>$v) {
if(preg_match('/pics(\d+)/i',$k,$out)) {
if($v != ''){
$pics[$out[1]] = $v;
}
unset(front::$post[$k]);
}
}
front::$post['pics'] = serialize($pics);
if(!front::post('attr1')) {
front::$post['attr1']='';
}
if(!front::$post['introduce']){
front::$post['introduce']=cut(strip_tags(front::$post['content']),front::$post['introduce_len']*2);
}
if(front::$post['savehttppic']){
front::$post['content'] = stripslashes(front::$post['content']);
front::$post['content'] = preg_replace_callback('%(<img\s[^>|/>]*?src\s*=\s*["|\']?)([^"|\'|\s>]*)%is','savepic', front::$post['content']);
front::$post['content'] = addslashes(front::$post['content']);
}
//var_dump(front::$post['content']);exit;
if(front::$post['autothumb']){
front::$post['content'] = stripslashes(front::$post['content']);
preg_match('%(<img\s[^>|/>]*?src\s*=\s*["|\']?)([^"|\'|\s>]*)%is', front::$post['content'],$out);
$out[1] = '';
//$out[2] = savepic1($out);
if(!$out[2]) return;
//front::$post['thumb'] = str_ireplace(config::get('site_url'),'',$out[2]);
$len = 1;
if(config::get('base_url') != '/'){
$len = strlen(config::get('base_url'))+1;
}
if(substr($out[2],0,4) == 'http'){
front::$post['thumb'] = str_ireplace(config::get('site_url'),'',$out[2]);
}else{
front::$post['thumb'] = substr($out[2],$len);
}
$catid = front::get('catid');
$thumb=new thumb();
$thumb->set(front::$post['thumb'],'file');
front::$post['thumb'] = str_ireplace('.jpg','_s.jpg',front::$post['thumb']);
if ($catid)
$thumb->create(front::$post['thumb'],category::getwidthofthumb($catid),category::getheightofthumb($catid));
else
$thumb->create(front::$post['thumb'],config::get('thumb_width'),config::get('thumb_height'));
$sp = $len>1?'/':'';
front::$post['thumb'] = config::get('base_url').$sp.front::$post['thumb'];
if(substr(front::$post['thumb'], 0,1) != '/'){
front::$post['thumb'] = '/'.front::$post['thumb'];
}
front::$post['content'] = addslashes(front::$post['content']);
}
}