Dream CMS Batch create thumbnails for pjpeg format pictures

Source: Internet
Author: User

Dedecms can only create thumbnails for gif|jpg|bmp|png four picture formats, and for now, there are quite a few picture formats, such as Pjpege format pictures,

Default is not created, you can open the dede/inc|inc_archives_functions.php file, find the function getddimgfrombody (& $body)

The following first

The code is as follows Copy Code
Preg_match_all ("/src) =[" | | {0,} ([^>]*. (gif|jpg|bmp|png))
Amended to
Preg_match_all ("/src) =[" | | {0,} ([^>]*. (Gif|jpg|bmp|png|pjpeg))

This is OK, but also what other formats of the picture, add it

In this way it may come out with the generated thumbnail deformation also introduce the method below

Find include/image.func.php,

Modify:

The code is as follows Copy Code

if ($toWH <= $srcWH)
{
$ftoW = $toW;
$ftoH = $ftoW * ($srcH/$srcW);
}
Else
{
$ftoH = $toH;
$ftoW = $ftoH * ($srcW/$srcH);
}
For

$ftoH = $toH;
$ftoW = $toW;
if ($toWH <= $srcWH) {
$src _y = 0;
$src _x = ($srcW-$srcH * $toWH)/2;
$srcW = $srcH * $toWH;
}
else {
$src _x = 0;
$src _y = ($srcH-$srcW/$toWH)/2;
$srcH = $srcW/$toWH;
}

More

Change

The code is as follows Copy Code

($ni, $im, 0,0,0,0, $ftoW, $ftoH, $srcW, $srcH)

For

($ni, $im, 0,0, $src _x, $src _y, $ftoW, $ftoH, $srcW, $srcH)

After the modification there is a feature: Publish the article, the editor upload pictures
1, if not selected to generate thumbnails
The original picture path is similar to Uploads/090620/1_124844_1.jpg

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.