WordPress.org

Ready to get started?Download WordPress

Forums

Easy Watermark
[resolved] Scaling the watermark? (3 posts)

  1. Alex
    Member
    Posted 8 months ago #

    Hi there,

    I noticed that watermark is bigger on smaler images (like thumbs) than on bigger ones - because the watermark absolute size remains the same for all images.

    Now, can we change the watermark size to be in percent? Or somehow variable wth the image size?

    For text I figured out the code below, but for images seems pretty complex for me, can you help with this?

    My code for scaling the text is (at line 621 in EasyWatermark.php):

    // Compute relative text size
    // Standards: imageHeight = 1500 & textSize = 32
    // RELtextSize = (imageHeight / 1500) * ABStextSize
    // This way the font size will be scalled comparing to a 1500 px height image!
    $absTextSize = $settings['size'];
    $relTextSize = ( $imageHeight / 1500 ) * $absTextSize;
    //... but not if text size gets too small (ex. for preview)
    if ($relTextSize < 1) { $relTextSize = $absTextSize; }
    
    imagettftext($this->outputImage,
    $relTextSize,
    $settings['angle'],
    $offsetX - $deltaX, $offsetY - $deltaY,
    $color,
    $settings['font'],
    $this->text);

    Thanks!

    http://wordpress.org/plugins/easy-watermark/

  2. szaleq
    Member
    Plugin Author

    Posted 7 months ago #

    Hi Alex,

    Actually there is an option to scale image watermark, you can set this on the watermark settings page (Settings > Easy Watermark > "Image" tab, just below the alignment settings). Watermark can be scaled to width or height. There is also an option to scale watermark only for images smaller than the watermark image. Hope it will be useful, please tell me if you found this settings and can use it.

    The text scaling option is missing now in the original plugin, but it will be added in the next release.

  3. Alex
    Member
    Posted 7 months ago #

    Yes, I found it, thank you!
    Now I'll craft a composed scaling watermark using author name and site logo for a photography colaborative website, wish me luck at this one, ok?

Reply

You must log in to post.

About this Plugin

About this Topic