This repository has been archived by the owner on Oct 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Watermarking
joehoyle edited this page Nov 25, 2011
·
3 revisions
To overlay a second image on the source image (such as a watermark), you must specify several options for the 'watermark_options' value in the form of an associative array. The arguments are:
{
mask: `string` - The image path / url to be overlayed on the source image
pre_resize: `bool` (false) - Whether to apply the everlayed image before the source image is resized
padding: `int` (0) - The amount of pixels the watermark should be applied from the edge of the source image.
position: `string` (cc) - The position on the source image where the watermark should be applied. ["c" (center), "t" (top), "l" (left), "r" (right), "b" (bottom)]
}
For example, to apply a watermark to a test image:
wpthumb( 'photo.png', array( 'width' => 300, 'height' => 500, 'watermark_options' => array( 'mask' => 'logo.png', 'position' => 'tl', 'padding' => 10 ) );
Ofcourse you can also resize the waterark image by passing it through wpthumb
first:
wpthumb( 'photo.png', array( 'width' => 300, 'height' => 500, 'watermark_options' => array( 'mask' => wpthumb( 'logo.png', 'width=100&height=20'), 'position' => 'tl', 'padding' => 10 ) );