Dream dedecms Batch Extract first picture for thumbnail _ Weaving Dream

Source: Internet
Author: User

Sometimes not satisfied with the thumbnails extracted from the dream, or the dream is not able to automatically extract the first picture as a thumbnail, this time need to use the Dream Dedecms batch extract the first picture for the function of the thumbnail. Black Cat Sheriff made a beautiful pictures of the site, because the collection of pictures are uploaded, can not automatically get thumbnails, so deliberately get a batch to get the first picture for the function of the thumbnail. At the moment, at least DedeCMS5.7 is available, and other versions are not tested and are theoretically available.

Dream-weaving background has a bulk maintenance function >> automatic summary | Paging function, in order to better manage, Black Cat Sheriff on this batch extract the first picture for the function of the thumbnail here, looks more harmonious, in addition, you can fill in the beginning and end of the ID to achieve the bulk of the function. Emphasize that you should make a backup of the corresponding file before you modify it. First open the Dream management backstage article_description_main.php file, in the

}//Get automatic summary code end

After adding the following batch to extract the thumbnail image function code

Gets the first image as a thumbnail if ($dojob = = ' Spic ') {require_once (dedeadmin.)
/inc/inc_archives_functions.php ");
    if (empty ($totalnum)) {$addquery = "";
    $addquery 2 = "";
    if ($sid!=0) {$addquery = "and id>= $sid";
    } if ($eid!=0) {$addquery 2 = "and id<= $eid";
    $tjQuery = "SELECT count (*) as DD from dede_archives where channel= ' {$channel} ' $addquery $addquery 2";
    $row = $dsql->getone ($tjQuery);
$totalnum = $row [' DD '];
    } if ($totalnum > 0) {$addquery = "";
    $addquery 2 = "";
    if ($sid!=0) {$addquery = "and dede_archives.id>= $sid";
    } if ($eid!=0) {$addquery 2 = "and dede_archives.id<= $eid"; $fquery = "Select dede_archives.id,dede_archives.litpic,{$table}. {$field} From dede_archives left join {$table} on {$table}.aid=dede_archives.id where dede_archives.channel= ' {$channel} ' $ AddQuery $addquery 2 limit $STARTDD, $pagesize;
    ";
    $dsql->setquery ($fquery);
    $dsql->execute (); while ($row = $dSql->getarray ()) {//$tid = $row [' id ']; $body = $row [$field]; $litpic = Getddimgfrombody ($body); $dsql->executenon
    Equery ("Update dede_archives set litpic= ' $litpic ' where id= ' {$row [' id ']} ';");
    //Return progress Information $STARTDD = $STARTDD + $pagesize;
    if ($totalnum > $STARTDD) {$tjlen = Ceil (($STARTDD/$totalnum) * 100); }else {$tjlen =100 echo completes all tasks.
";
    Exit ();
    $dvlen = $tjlen * 2; $tjsta = "<div style= ' width:200;height:15;border:1px solid #898989; Text-align:left ' ><div style= ' width:$
    Dvlen;height:15;background-color: #829D83 ' ></div></div> '; $tjsta. = "<br/> $tid ...
    To complete the total number of documents processed: $tjlen%, continue to perform tasks ... "; $nurl = "article_description_main.php?totalnum= $totalnum &startdd={$startdd}&sid= $sid &eid= $eid & pagesize= $pagesize &table={$table}&field={$field}&dsize={$dsize}&msize={$msize}&channel={$
    channel}&dojob={$dojob} ";
    ShowMsg ($tjsta, $nurl, 0,500);
Exit (); }else {echo "does not meet the condition of the action noteRecorded.
    ";
Exit (); }//First thumbnail end

The above is the Program function section, and then you need to modify the background management template file to submit data processing. Specific is the dream of the background Management directory Templets folder under the Article_description_main.htm file, find the following code:

<input type= "Radio" name= "Dojob" class= "NP" value= "page" >              automatic Paging

After this code, add the following:

<input type= Radio name= Dojob class= NP value= >                auto Thumbnail

This completes the batch extraction of the first picture for the function of the thumbnail, the completion of the effect of the interface as shown below:

Weave Dream Batch Extract thumbnail image

When used and batch extraction of keywords, automatic summary, paging and so on are the same operation, with this batch extraction function of the thumbnail can be used to upload the image function, you can also modify the dream of the function of the thumbnail functions, to solve the problem of dream thumbnail deformation, the Black Cat Sheriff in a later time to send up.

And then run MySQL with

Update ' dede_archives ' set flag= ' P ' WHERE litpic <> '

Complete.

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.