In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to add text watermark to pictures by PHP". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to add text watermarks to pictures by PHP".
PHP adds a text watermark instance to the picture, supports Chinese text watermark, whether to overwrite the original image, and customizes the background color, text color, font and so on.
Watermark water.class.php
Var $Path = ". /"; / / the directory where the picture resides relative to the relative path of the page calling this class var $FileName = ""; / / the name of the picture, such as "1.jpg" var $Text = ""; / / the watermark text to be added to the picture, which supports Chinese var $TextColor = "# ffffff"; / / the color of the text, the font color can only be black var $TextBgColor = "# 000000" for gif images. / / the color of the background bar of the text var $Font = "c://windows//fonts//simhei.ttf"; / / the directory where the font is stored, the relative path var $OverFlag = true; / / whether to overwrite the original image, default to overwrite, if not, automatically + "_ water_down" after the file name of the original image, such as "1.jpg" = > "1_water_down.jpg" var $BaseWidth = 200 / / the width of the image must be at least > = 200 before the watermark text will be added.
Call the watermark class
Include_once 'water.class.php'; $objImg = new sucaihuoWaterChinese (); $objImg- > Path = "images/"; $objImg- > FileName = "1.jpg"; $objImg- > Text = iconv (' UTF-8','GB2312',' material www.sucaihuo.com'); $objImg- > Font = ". / fonts/simhei.ttf"; / / font location $objImg- > TextBgColor = "# ffffff"; / / text background color $objImg- > TextColor = "# ffffff"; / / text color $objImg- > OverFlag = false / / whether to overwrite the original image $objImg- > Run (); at this point, I believe you have a better understanding of "how to add text watermarking to pictures by PHP". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.