移除附件重新绘制功能
parent
eb9fd34986
commit
3706a9209d
|
|
@ -36,20 +36,6 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label>{{$data.is_upload_images_redraw.name}}<span class="am-form-group-label-tips">{{$data.is_upload_images_redraw.describe}}</span></label>
|
||||
<select name="{{$data.is_upload_images_redraw.only_tag}}" class="am-radius chosen-select" data-validation-message="{{$data.is_upload_images_redraw.error_tips}}" required>
|
||||
{{foreach $common_is_text_list as $v}}
|
||||
<option value="{{$v.id}}" {{if isset($data['is_upload_images_redraw']['value']) and $data['is_upload_images_redraw']['value'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
|
||||
{{/foreach}}
|
||||
</select>
|
||||
<div class="am-alert am-alert-warning" data-am-alert>
|
||||
<button type="button" class="am-close">×</button>
|
||||
<p>1. 默认否、建议开启上传图片重新绘制、防止木马病毒图片上传</p>
|
||||
<p>2. 开启后gif动态图片将失效、由于重新绘制图片大小也会改变</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
|
||||
<input type="hidden" name="nav_type" value="{{$nav_type}}" />
|
||||
|
|
|
|||
|
|
@ -237,55 +237,8 @@ class Uploader
|
|||
return;
|
||||
}
|
||||
|
||||
// 如未安装相应的gd库则直接存储文件
|
||||
// 未开启重新绘制
|
||||
$is_move = false;
|
||||
|
||||
// 是否开启图片重新绘制
|
||||
if(MyC('is_upload_images_redraw', 0) == 1)
|
||||
{
|
||||
switch($this->fileType)
|
||||
{
|
||||
case '.png':
|
||||
if(function_exists('imagecreatefrompng'))
|
||||
{
|
||||
$image = imagecreatefrompng($file["tmp_name"]); //PNG
|
||||
imagesavealpha($image, true); //这里很重要 意思是不要丢了$sourePic图像的透明色;
|
||||
$width = imagesx($image); //图宽度
|
||||
$heigh = imagesy($image); //图高度
|
||||
$thumb = imagecreatetruecolor($width, $heigh);
|
||||
imagealphablending($thumb, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;
|
||||
imagesavealpha($thumb, true); //这里很重要,意思是不要丢了$thumb图像的透明色;
|
||||
if(imagecopyresampled($thumb, $image, 0, 0, 0, 0, $width, $heigh, $width, $heigh))
|
||||
{
|
||||
imagepng($thumb, $this->filePath);
|
||||
}
|
||||
} else {
|
||||
$is_move = true;
|
||||
}
|
||||
break;
|
||||
case '.gif':
|
||||
if(function_exists('imagecreatefromgif'))
|
||||
{
|
||||
@imagegif(@imagecreatefromgif($file["tmp_name"]), $this->filePath);
|
||||
} else {
|
||||
$is_move = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(function_exists('imagecreatefromjpeg'))
|
||||
{
|
||||
@imagejpeg(@imagecreatefromjpeg($file["tmp_name"]), $this->filePath, 100);
|
||||
} else {
|
||||
$is_move = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$is_move = true;
|
||||
}
|
||||
|
||||
// 是否需要直接存储文件
|
||||
if($is_move && !move_uploaded_file($file["tmp_name"], $this->filePath))
|
||||
if(!move_uploaded_file($file["tmp_name"], $this->filePath))
|
||||
{
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_FILE_MOVE");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue