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