{Dede:field name= ' image '} Controls picture size settings

Source: Internet
Author: User
Keywords DEDECMS picture size

Today, the wind network will target the {Dede:field http://www.aliyun.com/zixun/aggregation/11696.html ">name= ' image"} in Dedecms The label controls the size of the picture to teach you how to set it.

The method of controlling picture size is usually controlled by CSS, but we would prefer to modify the code implementation in the template tag:




dedecms {Dede:field name=\image\} Label controls picture size


 

Method One:

Locate the location of the code in the template such as:

<div class= "Picview" >
{Dede:field name= ' image '/}
</div>

Replace it with:
<div class= "Picview" >
<img src= "{dede:field name= ' litpic '/}" width= "height=" >
</div>

This is free to realize the size of the pictures in each template, very convenient! Wind Letter Network recommended that you use this method.

Method Two:

Modify file: include/arc.archives.class.php 262 Line

Template to get thumbnails directly using {Dede:field name= ' image '/}
$this->fields[' image '] = (!eregi (' Jpg|gif|png ', $this->fields[' Picname ')? ":" <img src= ' {$this->fields[' picname ']} '/> ');

Replace it with:

$this->fields[' image '] = (!eregi (' Jpg|gif|png ', $this->fields[' Picname ')? ":" <img src= ' {$this->fields[' picname ']} ' onload= ' Javascript:if (this.width>400) this.style.width=400; ' /> ");

Plus onload= "javascript:if (this.width>400) this.style.width=400;" can picture size. More than 400 shows only 400, and less than 400 shows the actual picture size.

The disadvantage of this approach is that each picture is width=400, and the display of some pictures may affect the page effect.

You can choose to use according to your own needs.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.