
What should I do if phpcms cannot add watermark?
phpcms remote image localization failure and watermark function failure tutorial
The specific modifications are as follows: include/attachment.class.php added a function
The code is as follows:
function ycimg($file,$newfile)
{
// 初始化一个 cURL 对象
$curl = curl_init();
// 设置你需要抓取的URL
curl_setopt($curl, CURLOPT_URL, $file);
// 设置header
curl_setopt($curl, CURLOPT_HEADER, 0);
// 设置cURL 参数,要求结果保存到字符串中还是输出到屏幕上。
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// 运行cURL,请求网页
$data = curl_exec($curl);
// 关闭URL请求
curl_close($curl);
//写入获得的数据
$write = @fopen($newfile,"w");
fwrite($write,$data);
fclose($write);
return TRUE;
}There may be a small problem here. However, it can be successfully captured during the test. So it directly returns TRUE. Interested friends can continue to improve this function.
Then find
if(@$upload_func($file, $newfile))
in this file and modify it to:
if($this->ycimg($file,$newfile))
Finally remove:
@chmod($newfile, 0777);
This section of code.
is captured remotely like this The success rate is very high. During local testing, the success rate is 100%, while the success rate of the copy function is less than 70%...
As mentioned above, network factors have a greater impact.
Then there is the function of adding watermarks to remotely saved pictures.
It is still the same file. Find the following code:
$this->downloadedfiles[$aid] = $filepath;
Add the following code below:
The code is as follows:
$waterpath = UPLOAD_URL.$filepath; require_once 'image.class.php'; $image = new image(); $image->watermark($waterpath, '', '9', 'images/watermark.gif', '', '5', '#ff0000', '80','100');
The watermark parameters can only be adjusted here, and the settings in the system are invalid...
PHP Chinese website, a large number of free PHPCMS tutorials, welcome to learn online!
The above is the detailed content of What should I do if phpcms cannot add watermark?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor





