How to add watermarks to images in discuz x3.x category Information
This is a problem solved when configuring the company website some time ago. Now, read the previous notes and give it to anyone who needs this function.
Youdao cloud Note: Creation Time:
After several days of code analysis, I found the place where I needed to add the watermark, and finally added only a few lines of code.
Direct topic: source/class/extend/extend_thread_sort.php is the extend_thread_sort class, and its public function after_newthread () if ($ _ G ['Forum _ optionlist'] [$ optionid] ['type'] = 'image '){
$ Identifier = $ _ G ['Forum _ optionlist'] [$ optionid] ['identifier'];
$ Sortaids [] = intval ($ _ GET ['tyexception'] [$ identifier] ['aid ']);
Require_once libfile ('class/image ');
$ Image = new image;
$ Imgoptiondata = dunserialize ($ value );
If ($ _ G ['setting'] ['watermarkstatus'] & empty ($ _ G ['forum'] ['disablewatermark']) {
$ Image-> Watermark ($ imgoptiondata ['url'], '', 'Forum ');
$ Update ['filesize'] = $ image-> imginfo ['SIZE'];
Red indicates the added code.
The analysis process is twists and turns. As we have been relatively familiar with the classification information some time ago and know the entire parsing process of the category information in disucz, this time we add a watermark based on the image attached to the Forum, position the watermark to be added step by step.