dedecms采集的时候自动把图片上传到又拍云
2013-07-22 17:08
423 查看
打开dede/co_export.php找到37行在require_once(DEDEINC.'/dedecollection.class.php');下面判断时候开启了又拍云
/*
*是否开启又拍云
*导入unyun.class
*/
$cfg_upyun_username 又拍用户名
$cfg_upyun_spacename 空间名
$cfg_upyun_password密码
然后找到247行 $addSql = str_replace("@$itemname@", $itemvalue, $addSql);在下面增加如下代码
以上就是采集完成导出内容的时候把图片附件上传到又拍云上面。写的不好,请见谅。如有更好的解决方式请告知谢谢!sobeautiy@126.com
太囧笑话网
/*
*是否开启又拍云
*导入unyun.class
*/
if (($cfg_open_upyun == 'Y') && $cfg_upyun_username && $cfg_upyun_spacename && $cfg_upyun_password ) { include DEDEADMIN.'/inc/UpYun.class.php'; $upyun = new UpYun($cfg_upyun_spacename, $cfg_upyun_username, $cfg_upyun_password); $openUpYun = true; } else { $openUpYun = false;; }$cfg_open_upyun开关,我在后台添加了一个boolean类型的变量
$cfg_upyun_username 又拍用户名
$cfg_upyun_spacename 空间名
$cfg_upyun_password密码
然后找到247行 $addSql = str_replace("@$itemname@", $itemvalue, $addSql);在下面增加如下代码
//开启又拍云存储 if($openUpYun) { $values = $ctag->GetInnerText(); if($itemname == 'litpic') { try { $fh = fopen('../..'.$values, 'rb'); $rsp = $upyun->writeFile('/'.$litpic, $fh, True); // 上传图片,自动创建目录 fclose($fh); } catch(Exception $e) { echo $e->getCode(); echo $e->getMessage(); exit; } } if($itemname == 'imgurls') { $dtp = new DedeTagParse(); $dtp->LoadSource(stripslashes($values)); if(is_array($dtp->CTags)) { foreach($dtp->CTags as $ctag) { if($ctag->GetName()=="img") { $bigimg = trim($ctag->GetInnerText()); if($ctag->GetAtt('ddimg') != $bigimg && $ctag->GetAtt('ddimg')!='') { $litimg = $ctag->GetAtt('ddimg'); } else { $litimg = $bigimg; } try { $fh = fopen('../..'.$litimg, 'rb'); $rsp = $upyun->writeFile($litimg, $fh, True); // 上传图片,自动创建目录 fclose($fh); } catch(Exception $e) { echo $e->getCode(); echo $e->getMessage(); exit; } } } } $dtp->Clear(); } }fopen里面的路径需要根据实际情况修改下。
以上就是采集完成导出内容的时候把图片附件上传到又拍云上面。写的不好,请见谅。如有更好的解决方式请告知谢谢!sobeautiy@126.com
太囧笑话网
相关文章推荐
- 调试台自动多出现一个'' ,我 用uploadify上传图片时,在给页面写入一个返回值为图片名称的变量的值的时候值的前面始终多出现一个''
- 如何让wordpress上传图片的时候自动命名?
- KindEditor粘贴时候自动上传远程图片(非本地)
- DEDEcms图片附件上传到又拍云使用云存储
- dedecms上传图片不自动改名,以利于seo图片优化
- 与众不同 windows phone (43) - 8.0 相机和照片: 镜头的可扩展性, 图片的可扩展性, 图片的自动上传扩展
- 使用JS+plupload直接批量上传图片到又拍云
- DEDECMS给图集图片{dede:productimagelist}自动编号
- 【ASP.NET 进阶】图片自动上传和局部刷新显示
- thinkphp结合KindEditor 上传图片的时候出现“\”导致图片不能正常显示,
- 14-ASP.NET 使用FileUpload控件上传图片并自动生成缩略图
- 使用FileUpload控件上传图片并自动生成缩略图、自动生成带文字和图片的水印图
- 上传图片时JS自动显示图片
- C#图片上传,加水印,自动生成缩略图类
- 图片上传的Codebehind(自动生成所略图)
- commons FileUpload 上传图片,服务器文件夹不能自动刷新的解决方案
- 关于asp.net上传图片自动生成缩略图
- dedecms 自定义模型中图片字段无法选择及无法上传问题的解决方案
- FreeTextBox在点击上传图片的时候弹出无法找到脚步库"/aspnet_client/system_web/1_1_4322/webuivalidation.js
- HTML问题 --图片选择后自动上传 --chrome 中parent对象