Questions about php & cakephp Image Display

Source: Internet
Author: User
Php & amp; cakephp show picture problem Reference: http://bbs.csdn.net/topics/360220433privatefunctionoutputFile2Brower () {$ filename = WWW_ROOT. ".../../". $ t php & cakephp show picture problem
Reference: http://bbs.csdn.net/topics/360220433

Private function outputFile2Brower () {$ filename = WWW_ROOT. ".../". $ this-> request-> url; if (! File_exists ($ filename) {throw RuntimeException ("File $ filename not found");} // TODO: the type string/* is incorrect, it is easy to cause some images to fail to display the header ("Content-Type: image/jpg"); header ("Content-Length :". filesize ($ filename); readfile ($ filename); */$ image = file_get_contents ($ filename); // $ content = addslashes ($ image ); header ('content-type: image/jpg '); echo $ image ;}

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.