Commit 049b9a56 authored by zhangkuanguang's avatar zhangkuanguang

芜湖上传图片

parent 32fdb8dd
......@@ -1048,4 +1048,28 @@ class Pic_model extends MY_Model {
$this->db->where('id', $id);
return $this->db->get($this->_insert_temp_tablename)->row_array();
}
public function pic_format($image_path,$format = ''){
if (!empty($image_path) && preg_match('/\.com\/[A-Z]{1}[0-9]{2}\//', $image_path)) {
preg_match('/_([0-9]+)x([0-9]+)/', $image_path, $match);
//先把问号后的内容全部去掉
$strrpos1 = strpos($image_path, '?');
if($strrpos1 != FALSE){
$image_path = substr($image_path, 0,$strrpos1);
}
if ($match) {
$strrpos = strpos($image_path, $match[0]);
$picNameArr = explode('.', substr($image_path, $strrpos));
$image_path = substr($image_path, 0, $strrpos);
if($format){
$image_path .= $format . '.' . $picNameArr[1];
}else{
$image_path .= '.'.$picNameArr[1];
}
}
return $image_path;
}
return $image_path;
}
}
\ No newline at end of file
......@@ -173,12 +173,20 @@ foreach($arr_sort as $key=>$sort) { ?>
<?php
if($bolHasHouse)
{
$this->load->model('pic_model');
$pic1 = empty($house_detail['pic1'])?'':$house_detail['pic1'];
if($pic1){
$pic1 = $this->pic_model->pic_format($pic1);
}
foreach($house_detail['house_pic' . $key] as $k => $v){
$title = $v['title'] == '' ? '图片描述30字' : $v['title'];
if (!isset($house_detail['pic1']))
{
$house_detail['pic1'] = '';
}
$pic_format = $this->pic_model->pic_format($v['filename']);
?>
<div style="" class="mItem">
<div class="mItemInner" id="yyyyyy">
......@@ -188,7 +196,7 @@ foreach($arr_sort as $key=>$sort) { ?>
<input type="hidden" name="p_sort[]" value="<?=$v['sort']?>" class="psort">
<div class="funM"></div>
<div class="funMtext">
<label><input type="radio" onclick="setIndexPic(this);" value="<?=$v['filename']?>" class="input_r" name="jsPicPreviewList" <?php if($house_detail['pic1'] == $v['filename'] && $isfaceimg){ $isfaceimg = false; ?> checked <?php } ?>>封面</label>
<label><input type="radio" onclick="setIndexPic(this);" value="<?=$v['filename']?>" class="input_r" name="jsPicPreviewList" <?php if($pic1 == $pic_format){ ?> checked <?php } ?>>封面</label>
<a class="bigPicLin" style="bottom:84px;" target="_balnk" href="<? echo str_replace('/thumb','',$v['filename']); ?>" title="查看大图">查看大图</a>
<div class="delBtn" id="<?=$v['sort']?>" imageSrc='<?=$v['filename']?>' title="删除" onclick="setPicDel(<?=$v['id']?>);"></div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment