Step for scaling phpcms article content-php Tutorial

Source: Internet
Author: User
In phpcms modulescontentindex. php, the image scaling method is to match the img Image address and use thumb for scaling and replacement .?? In the show () method, modify $ content? Contentpreg_replace (& lt; img [^ & gt;] * src []? ([^ & Gt; Method for scaling down the phpcms article content

In/phpcms/modules/content/index. php, modify

The method is to match the img Image address and use thumb for scaling and replacement to display the image.

?

?

In the show () method, modify $ content

?

Content = preg_replace ('/] * src = [\' "]? ([^> \ '"\ S] *) [\'"]? [^>] *>/Ie ', "self: changeThumb (' $ 0', '$ 1')", $ content );

??

Match the image and give it to the class function changgeThumb. $0 matches the entire img code. $1 matches the image url.

?

?

Protected static function changeThumb ($ old, $ path) {$ width = 580; // escape the passed string and remove $ old = str_replace ('\"', '"', $ old); // The built-in thumb function, no stranger $ new = str_replace ($ path, thumb ($ path, $ width, 0 ), $ old); return $ new ;}

? Okay, so you can see if all the images on your page have become thumbnails,

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.