Phpcms V9 Calling a custom field the first or nth image of a multi-image is a thumbnail image

Source: Internet
Author: User

1. Open the Group field for the model you want to use, and add a group field prompt to

1 <Divclass= "Content_attr"> 2 <label><inputtype= ' checkbox 'name= ' AUTO_THUMBP 'value= "1"checked>Whether to get content</label><inputtype= "text"name= "Auto_thumb_nop"value= "1"size= "2"class="">Photo as Title picture3 </Div> 

2. Open phpcms\model\content_model.class.php to find the following:

1 //Auto-extract thumbnail image2 if(isset($_post[' Auto_thumb ']) &&$systeminfo[' thumb '] = = ' &&isset($modelinfo[' Content '])) { 3  $content=$content?$content:stripslashes($modelinfo[' Content ']); 4  $auto _thumb_no=intval($_post[' Auto_thumb_no ']) -1; 5  if(Preg_match_all("/(SRC) = ([\" | ']?) ([^ \ "' >]+\. (gif|jpg|jpeg|bmp|png)) \\2/i ",$content,$matches)) { 6   $systeminfo[' thumb '] =$matches[3] [$auto _thumb_no]; 7  } 8}

Add the following code below

1 //automatically extract photos as thumbnails2 if(isset($_post[' AUTO_THUMBP ']) &&$systeminfo[' thumb '] = = ' &&isset($modelinfo[' Content '])) {   3  $ custom Field name=$ custom Field name?$ custom Field name:stripslashes($modelinfo[' Custom field name ']); 4  $auto _thumb_no=intval($_post[' Auto_thumb_nop ']) -1; 5  if(Preg_match_all("/(= =) \s ([\b\" |]?) ([^ \ "' >]+\. (gif|jpg|jpeg|bmp|png)) \\2/i ",$ custom Field name,$matches)) { 6   $systeminfo[' thumb '] =$matches[3] [$auto _thumb_no]; 7  } 8}

Note: There are two pieces of content_model.class.php file to add this code, one is the new additions to the article, one is the time to modify the article!

Phpcms V9 Calling a custom field the first or nth image of a multi-image is a thumbnail image

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.