DX无后缀名图片下载,后缀名指(.jpg/.gif)

discuz!x默认识别后缀名有:jpg/jpeg/gif/png/bmp,五种。

目前部分网络图片不带后缀名或后缀名加了干扰,会导致远程下载图片失败。
打开\source\module\forum\forum_ajax.php文件

1、查找:

if(!$upload->is_image_ext($attach['ext'])) {
continue;
}

修改为:

if(!$upload->is_image_ext($attach['ext'])) {
$attach['ext'] = 'jpg';
}

2、查找:

$patharr = explode('/', $imageurl);

修改为:

$patharr = explode('/', '/DSC000'.time().'.'.$attach['ext']);

相关文章:

1、Discuz!X优化“Oops! System file lost”文件不存在的代码错误提示
https://www.onexin.net/discuzxoops-system-file-lost/

2、Discuz!X程序结构图
https://www.onexin.net/discuz-x-program-structure-diagram/

3、整合程序注册时自动激活DZX会员 for discuz!X 1.5
https://www.onexin.net/up-the-integration-process-is-automatically-activated-when-the-dzx-member-for-discuz-x-1-5/

4、supesite远程图片本地化并作为文章附件
https://www.onexin.net/supesite-remote-image-localization-and-as-a-post-attachments/

5、远程图片本地化 For wordpress
https://www.onexin.net/remote-image-localization-for-wordpress/

转载请注明出处:https://www.onexin.net/dx-extension-picture-download-extension-means-jpg-gif/

Leave a Reply

Your email address will not be published. Required fields are marked *