Home >CMS Tutorial >DEDECMS >How to obtain the original image address of the thumbnail image in Dedecms
How does Dedecms obtain the original address of the thumbnail image?
The example in this article describes how Dedecms obtains the original address of the thumbnail image. Share it with everyone for your reference. The specific analysis is as follows:
Recommended learning: 梦Weavercms
Here I will introduce to you a method of Dedecms to obtain the original address of the thumbnail image. This operation cannot be used. Regular to obtain, because random problems often occur.
Modify include/extend.func.php, please back up the original file before modifying, add the following code:
The code is as follows:
//取第一张图地址 function firstimg($str_pic) { $str_sub=substr($str_pic,0,-7).".jpg";//删除缩略图字符串最后七位,然后再补上后缀.jpg return $str_sub; }
Then loop the call in the template:
The code is as follows:
[field:litpic function=firstimg('@me')/]
To call directly:
The code is as follows:
{dede:field name='litpic' function="firstimg(@me)"/}
That’s it It is very easy to use, and I have tried several articles and they are all good, but there is one thing to note. If there is no thumbnail, we will not make a judgment.
I hope this article will be helpful to everyone's dedecms website building. help.
The above is the detailed content of How to obtain the original image address of the thumbnail image in Dedecms. For more information, please follow other related articles on the PHP Chinese website!