phpcms v9 调用自定义字段多图片的第一张或第N张图为缩略图
2014-10-30 16:55
218 查看
1.打开相应要使用组图的模型的组图字段,添加组图 字段提示为
2.打开phpcms\model\content_model.class.php 找到如下内容
在这下面添加如下代码
注意:content_model.class.php文件有两片需要添加这个代码,一处是新增加文章的时候,一处是修改文章的时候!
<div class="content_attr"> <label><input type='checkbox' name='auto_thumbp' value="1" checked>是否获取内容第</label><input type="text" name="auto_thumb_nop" value="1" size="2" class="">张图片作为标题图片 </div>
2.打开phpcms\model\content_model.class.php 找到如下内容
//自动提取缩略图 if(isset($_POST['auto_thumb']) && $systeminfo['thumb'] == '' && isset($modelinfo['content'])) { $content = $content ? $content : stripslashes($modelinfo['content']); $auto_thumb_no = intval($_POST['auto_thumb_no'])-1; if(preg_match_all("/(src)=([\"|']?)([^ \"'>]+\.(gif|jpg|jpeg|bmp|png))\\2/i", $content, $matches)) { $systeminfo['thumb'] = $matches[3][$auto_thumb_no]; } }
在这下面添加如下代码
//自动提取组图为缩略图 if(isset($_POST['auto_thumbp']) && $systeminfo['thumb'] == '' && isset($modelinfo['content'])) { $自定义字段名 = $自定义字段名 ? $自定义字段名 : stripslashes($modelinfo['自定义字段名']); $auto_thumb_no = intval($_POST['auto_thumb_nop'])-1; if(preg_match_all("/(=>)\s([\b\"|']?)([^ \"'>]+\.(gif|jpg|jpeg|bmp|png))\\2/i", $自定义字段名, $matches)) { $systeminfo['thumb'] = $matches[3][$auto_thumb_no]; } }
注意:content_model.class.php文件有两片需要添加这个代码,一处是新增加文章的时候,一处是修改文章的时候!
相关文章推荐
- DedeCMS系统自定义字段图片调用问题的解决方法
- 织梦DedeCMS系统自定义字段的图片调用
- dede调用图集第一张图片为缩略图,而且是大图不是缩略图
- Web_PHP_DedeCMS织梦自定义图片字段调用的问题出现{dede:img ..}
- phpcms v9 专题添加自定义字段及其调用
- dede中sql调用自定义字段中的图片
- phpcms v9调用自定义字段的方法
- DedeCMS系统自定义字段图片类型调用的路径问题解决办法.doc
- dede中sql调用自定义字段中的图片
- DedeCMS织梦自定义图片字段调用出现{dede:img ..}
- 解决织梦(DedeCMS)系统自定义字段图片调用问题
- phpcms 任意页面调用自定义字段多图片
- DedeCMS 自定义图片字段调用的有关问题解决{dede:img .}
- dedecmsV5.7自定义图片字段调用方法
- dedecms列表页文章有图调用缩略图 无图留空或自定义图片的方法!
- DEDECMS首页,列表页调用自定义图片字段,只显示图片地址
- 自定义字段 图片(无格式)只调用图片路径
- DedeCMS织梦自定义图片字段调用出现{dede:img ..}
- 织梦5.6 5.7(DedeCMS)自定义图片类型字段的调用
- 【原创】echsop列表页调用文章中第一张图片作为缩略图