自定义字段 图片(无格式)只调用图片路径
2014-04-19 19:49
288 查看
1、修改 /include/extend.func加入以下代码
[field:自定义图片字段名 function="GetOneImgUrl(@me,显示类型)"/]
比如:我们的自定义图片字段名为 datu 和 xiaotu,
只举例调用datu字段的方法,那么调用方式有以下两种:
[field:datu function='GetOneImgUrl(@me,0)'/] 调用图片的信息,自动调用宽度和高度(已包含Html代码的<img />)
[field:datu function='GetOneImgUrl(@me,1)'/] 只调用图片地址,一般可用于背景图嵌套
function GetOneImgUrl($img,$ftype=1){ if($img <> ''){ $dtp = new DedeTagParse(); $dtp->LoadSource($img); if(is_array($dtp->CTags)){ foreach($dtp->CTags as $ctag){ if($ctag->GetName()=='img'){ $width = $ctag->GetAtt('width'); $height = $ctag->GetAtt('height'); $imgurl = trim($ctag->GetInnerText()); $img = ''; if($imgurl != ''){ if($ftype==1){ $img .= $imgurl; } else{ $img .= '<img src="'.$imgurl.'" width="'.$width.'" height="'.$height.'" />'; } } } } } $dtp->Clear(); return $img; } }
[field:自定义图片字段名 function="GetOneImgUrl(@me,显示类型)"/]
比如:我们的自定义图片字段名为 datu 和 xiaotu,
只举例调用datu字段的方法,那么调用方式有以下两种:
[field:datu function='GetOneImgUrl(@me,0)'/] 调用图片的信息,自动调用宽度和高度(已包含Html代码的<img />)
[field:datu function='GetOneImgUrl(@me,1)'/] 只调用图片地址,一般可用于背景图嵌套
相关文章推荐
- DedeCMS系统自定义字段图片类型调用的路径问题解决办法.doc
- phpcms 任意页面调用自定义字段多图片
- 解决织梦(DedeCMS)系统自定义字段图片调用问题
- phpcms v9 调用自定义字段多图片的第一张或第N张图为缩略图
- Web_PHP_DedeCMS织梦自定义图片字段调用的问题出现{dede:img ..}
- android自定义Glide图片加载(以更改Glide缓存路径和使用ARGB_8888的图片格式为例)
- DedeCMS系统自定义字段图片调用问题的解决方法
- DedeCMS织梦自定义图片字段调用出现{dede:img ..}
- DEDECMS首页,列表页调用自定义图片字段,只显示图片地址
- DedeCMS织梦自定义图片字段调用出现{dede:img ..}
- echarts自定义功能按钮图片 网络路径格式
- 织梦5.6 5.7(DedeCMS)自定义图片类型字段的调用
- dedecmsV5.7自定义图片字段调用方法
- 织梦DedeCMS系统自定义字段的图片调用
- dede中sql调用自定义字段中的图片
- DedeCMS 自定义图片字段调用的有关问题解决{dede:img .}
- dede中sql调用自定义字段中的图片
- 安卓调用系统相机,通过路径返回清晰图片
- android 调用系统图片浏览器并返回图片路径
- DedeCMS添加自定义字段调用不出值的解决办法