Use the discuz image class-PHP source code

Source: Internet
Author: User
Use the image class of discuz
// File domain name // processing method // new image if (! Empty ($ _ FILES ['Attach '] ['tmp _ name']) & is_uploaded_file ($ _ FILES ['Attach'] ['tmp _ name']) {$ query = DB: query ("select filename, filepath from pre_home_hall_pic where picid = $ picid"); while ($ value = DB: fetch ($ query )) {$ oldfilepath = $ value ['filepath']; $ filename = $ value ['filename'];} $ file_info = pathinfo ($ _ FILES ['Attach '] ['name']); $ ext = $ file_info ['extension']; // get the extension $ filepath = dirname ($ oldfilepath ).' /'. Date ('his '). strtolower (random (16 )). '. '. $ ext; // rename $ uploadpath = 'data/attachment/hall/'randomly /'. $ filepath; if (! Is_dir ('data/attachment/hall /'. $ oldfilepath) {unlink ('data/attachment/hall /'. $ oldfilepath); unlink ('data/attachment/hall/'.w.oldfilepath.'.thumb.jpg ');} $ res = move_uploaded_file ($ _ FILES ['Attach'] ['tmp _ name'], $ uploadpath); if ($ res) {require_once libfile ('class/image'); $ image = new image (); $ result = $ image-> Thumb ($ uploadpath, '', 140,140, 1);} $ data ['filename'] = $ _ FILES ['Attach '] ['name']; $ data ['filepath'] = $ filepath;} DB: update ('home _ hall_pic ', $ data, $ wherearr );

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.