Jump to:

23493 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » watermark over an image?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 933 Views
  • janulka
    Avatar
    Community Member
    80 Posts

    watermark over an image? Link to this post

    Hello,

    I have following FittedImage.php:

    <?php
    class FittedImage extends Image {

    function generateMainImage($gd) {
    $gd->setQuality(85);
    return $gd->resizeRatio(600,600);
    }

    function generateThumbImage($gd) {
    $gd->setQuality(85);
    return $gd->resizeRatio(150,150);
    }

    }
    ?>

    Then I have new dataobject, called product, where:

    ...
    static $has_one = array (
          'ProductImage' => 'FittedImage'
       );
    ...

    And in template I am using

    ...
    <a href="$ProductImage.MainImage.URL" class="fancybox"><img src="$ProductImage.ThumbImage.URL" alt="$ProductName" /></a>
    ...

    What I would like to do, is to place small watermark (images/thumb-watermark.png) over thumb image and larger watermark (images/main-watermark.png) over main image.

    How do I do that? I found this topic: http://silverstripe.org/archive/show/275 but I have no idea what to do with the code. What do I put in the FittedImage.php and where do I put it, and what do I use in the template?

    Thanks a lot!

  • janulka
    Avatar
    Community Member
    80 Posts

    Re: watermark over an image? Link to this post

    anybody plz?

    933 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.