An example of PHP tutorial image watermarking, cut the head like a picture and automatically zoom code, he can upload your pictures to generate the specified size renderings and pictures can be automatically cut, see the following example.
<? / * PHP image watermarking, cut the head like a map and automatically zoom code
* /
class uploadrouter extends controller { function index () { // Output upload form, see the view file } function webimages () { print_r ($ _ files); $ img = c ("img"); $ img-> setinfo (/ / Set upload file attributes array ("files" => "upload", // upload file name "uploadpath" => $ globals ['config'] ['webprojectpath']. "upimages /", // upload directory "icopath" => $ globals ['config'] ['webprojectpath']. "upimages /", // thumbnail directory if not set will use the upload directory "icowidth" => "128", // small picture width "icoheight" => "98", // small picture high "fangpath" => $ globals ['config'] ['webprojectpath']. "upimages / _ico /" "fangsize" => "75", // plots how big If you set the cut square diagram then upload will generate a cut square, do not do not set "nzsize" => "180", // automatically set this width or height "uploadsize" => 420000 // upload image size ) ) -> setbasename ($ _ files ['upload'] ['name'], true) -> init (); //, 'size_ico', 'auto_ico', 'fix_ico', 'fill_size''fix_side' // You can set the name of the setbasename will automatically generate the name of the date, which will automatically swap the Chinese into Pinyin and filter the final initialization init () // Initialization is completed, you can upload if ($ img-> upload (array ('fix_side'))) / / upload, set to generate a small map. There are many formats if it is empty then upload pictures only ignore the other. { echo ("upload success"); } else { echo ("upload failed"); echo $ img-> message; } return false; } }
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.