Phpcms article content picture thumbnail steps

Source: Internet
Author: User
Phpcms article content image thumbnail method

Modify in/phpcms/modules/content/index.php

The method is to match the IMG image address, zoom and replace with the thumb to show it.

?

?

In the show () method, modify the $content

?

Content = preg_replace ('/]*src=[\ ' ")? ([^>\ ' "\s]*) [\'"]? [^>]*>/ie ', ' Self::changethumb (' $ ', ' $ ') ', $content);

??

Match the picture, give itself class function Changgethumb operation, $, match the entire IMG code, match out the image URL address

?

?

protected static function Changethumb ($old, $path) {       $width = 580;        The passed-in string has escaped, minus       $old = str_replace (' \ "', '" ', $old);       Its own thumb function, not unfamiliar       $new = Str_replace ($path, Thumb ($path, $width, 0), $old);      return  $new;}

Okay, so you can see if the pictures on your page are all turned into thumbnail images,

  • 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.