97久久国产亚洲精品超碰热,成人又色又爽的免费网站,色偷偷女人的天堂a,男女高潮喷水在线观看,国内精品一线二线三线区别在哪里
Discuz! 官方交流社區(qū)
標(biāo)題:
解決https下IE上傳圖片不顯示問(wèn)題
[打印本頁(yè)]
作者:
我是小站長(zhǎng)
時(shí)間:
2019-6-2 15:19
標(biāo)題:
解決https下IE上傳圖片不顯示問(wèn)題
本帖最后由 我是小站長(zhǎng) 于 2019-6-2 15:19 編輯
版本 dx 3.3
估計(jì)3.4一樣有這個(gè)問(wèn)題,ie內(nèi)核的瀏覽器下在上傳后,縮略圖都是顯示xx。
這個(gè)問(wèn)題主要還是https下,對(duì)圖片輸出的時(shí)候 不能使用
dheader('Content-Type: image');
復(fù)制代碼
必須要明確到j(luò)peg,png這里。
在forum_image.php文件里59行左右
需要改為
dheader('Content-Type: image/jpeg');
復(fù)制代碼
當(dāng)然這個(gè)并不完美
if($img->Thumb($filename, $thumbfile, $w, $h, $type)) {
if($nocache) {
dheader('Content-Type: image/jpeg');
@readfile($_G['setting']['attachdir'].$thumbfile);
復(fù)制代碼
這樣會(huì)讓png的圖片無(wú)法顯示出來(lái)。
可以增加一個(gè)函數(shù),來(lái)獲取mime類(lèi)型。
function get_image_extension($image){
$extension = pathinfo($filename,PATHINFO_EXTENSION);
if(in_array($extension,['jpg','jpeg','png','gif','bmp'])){
return 'image/'.$extension;
}
return 'image';
}
復(fù)制代碼
然后再去修改這個(gè)文件里輸出的頭部。
才可以徹底解決這個(gè)問(wèn)題。
php 5.3之后可以使用
function get_image_extension($filename){
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$rs = '';
if (!$finfo) {
return 'image';
}
$rs = finfo_file($finfo, $filename);
finfo_close($finfo);
return $rs;
}
復(fù)制代碼
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: forum_image.php 32531 2013-02-06 10:15:19Z zhangguosheng $
*/
if(!defined('IN_DISCUZ') || empty($_GET['aid']) || empty($_GET['size']) || empty($_GET['key'])) {
header('location: '.$_G['siteurl'].'static/image/common/none.gif');
exit;
}
$nocache = !empty($_GET['nocache']) ? 1 : 0;
$daid = intval($_GET['aid']);
$type = !empty($_GET['type']) ? $_GET['type'] : 'fixwr';
list($w, $h) = explode('x', $_GET['size']);
$dw = intval($w);
$dh = intval($h);
$thumbfile = 'image/'.helper_attach::makethumbpath($daid, $dw, $dh);$attachurl = helper_attach::attachpreurl();
function get_image_extension($filename){
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$rs = '';
if (!$finfo) {
return 'image';
}
$rs = finfo_file($finfo, $filename);
finfo_close($finfo);
return $rs;
}
if(!$nocache) {
if(file_exists($_G['setting']['attachdir'].$thumbfile)) {
dheader('location: '.$attachurl.$thumbfile);
}
}
define('NOROBOT', TRUE);
$id = !empty($_GET['atid']) ? $_GET['atid'] : $daid;
if(dsign($id.'|'.$dw.'|'.$dh) != $_GET['key']) {
dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
}
if($attach = C::t('forum_attachment_n')->fetch('aid:'.$daid, $daid, array(1, -1))) {
if(!$dw && !$dh && $attach['tid'] != $id) {
dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
}
dheader('Expires: '.gmdate('D, d M Y H:i:s', TIMESTAMP + 3600).' GMT');
if($attach['remote']) {
$filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'];
dheader('Content-Type: image');
dheader('location: '.$_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'].'?imageView2/1/w/'.$dw.'/h/'.$dh.'/format/jpg/interlace/0/q/80');
} else {
$filename = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
}
require_once libfile('class/image');
$img = new image;
if($img->Thumb($filename, $thumbfile, $w, $h, $type)) {
if($nocache) {
$mine = get_image_extension($_G['setting']['attachdir'].$thumbfile);
dheader('Content-Type: '.$mine);
@readfile($_G['setting']['attachdir'].$thumbfile);
//echo file_get_contents($_G['setting']['attachdir'].$thumbfile);
@unlink($_G['setting']['attachdir'].$thumbfile);
} else {
dheader('location: '.$attachurl.$thumbfile);
}
} else {
dheader('Content-Type: image');
@readfile($filename);
}
}
?>
復(fù)制代碼
作者:
耗子
時(shí)間:
2019-6-2 19:08
:lol感謝分享 干貨?。?hr noshade size="2" width="100%" color="#808080">
作者:
站長(zhǎng)
時(shí)間:
2019-6-16 15:39
感謝分享。。
作者:
欣欣向榮
時(shí)間:
2022-12-1 05:13
水平tall
歡迎光臨 Discuz! 官方交流社區(qū) (http://r615.cn/)
Powered by Discuz! X5.0