Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution of not adding watermark to phpcms

2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The solution that phpcms can't add watermark? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

What if I can't add watermarks to phpcms?

How to solve the problem of unsuccessful localization of phpcms remote images and failure of watermarking

The specific modifications are as follows: include/attachment.class.php added a function

The code is as follows:

Function ycimg ($file,$newfile) {/ / initialize a cURL object $curl = curl_init (); / / set the URLcurl_setopt you need to grab ($curl, CURLOPT_URL, $file); / / set headercurl_setopt ($curl, CURLOPT_HEADER, 0); / / set the cURL parameter that requires the result to be saved in a string or output to the screen. Curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1); / / run cURL, request web page $data = curl_exec ($curl); / / close URL request curl_close ($curl); / / write the obtained data $write = @ fopen ($newfile, "w"); fwrite ($write,$data); fclose ($write); return TRUE;}

There may be a little problem here. However, it can be successfully crawled during the test. So I sent him back to TRUE. Interested friends can continue to improve this function.

And find it in this file.

If (@ $upload_func ($file, $newfile))

Modified to:

If ($this- > ycimg ($file,$newfile))

Finally, get rid of:

@ chmod ($newfile, 0777)

This piece of code.

In this way, the success rate of remote crawling is very high. The success rate of local testing is 100%, while the success rate of copy function is less than 70%.

As mentioned above, the influence of network factors is relatively great.

Then there is the function of watermarking the pictures saved remotely.

It's the same document. 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 minutes, meme 100')

The watermark parameters can only be adjusted here, and the settings in the system are invalid.

Thank you for reading! After reading the above, do you have a general understanding of the solution that phpcms can not be watermarked? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report