主要是不知道你如何调用的,不敢断言怎么解决。。
如果楼主用的是X3的image模块动态调用的话,URL如:http://www.xxxxx.com/forum.php?mod=image&aid=92&size=145x145&key=45da6dc661494647&atid=24
这样的话,缩图是在WEB服务器的,我个人修改了一下这个模块,代码贴上,未经大数据测试,楼主试试用吧。这个是根据AID进行取缩图,URL中key的获取方式用dsign函数,具体方法请看DZ源码。其他参数请分析image模块。请先确认你的缩图是用下面的文件调用的(forum_image.php)- <?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();
- if(!$nocache) {
-
-
- //修改。判断远程是否存在缩图,若有则取出,否则调用本地,并将本地缩图传入远程。
- $hander= get_headers($_G['setting']['ftp']['attachurl'].$thumbfile);
- if($hander[0]=='HTTP/1.1 200 OK'){
- dheader('location: '.$_G['setting']['ftp']['attachurl'].$thumbfile);
- }elseif(file_exists($_G['setting']['attachdir'].$thumbfile)) {
- if(getglobal('setting/ftp/on')) {
- ftpcmd('upload', $thumbfile);
- }
- dheader('location: '.$attachurl.$thumbfile);
- }
- //END
- }
- 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'];
- //远程地址。
- $attachurl=$_G['setting']['ftp']['attachurl'];
- } else {
- $filename = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
- //远程地址。
- $attachurl=$_G['setting']['attachdir'];
- }
-
- require_once libfile('class/image');
- $img = new image;
- if($img->Thumb($filename, $thumbfile, $w, $h, $type)) {
- //判断FTP是否开启,若开启则传入远程
- if(getglobal('setting/ftp/on')) {
- ftpcmd('upload', $thumbfile);
- }
- //end
- if($nocache) {
- dheader('Content-Type: image');
- @readfile($attachurl.$thumbfile);
- @unlink($attachurl.$thumbfile);
- } else {
- dheader('location: '.$attachurl.$thumbfile);
- }
- } else {
- dheader('Content-Type: image');
- @readfile($filename);
- }
- }
- ?>
复制代码 |