We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37242 ☆ A M B ☆
    • 339 Posts
    Hi there,

    I am fetching remote XML data with ParseX and stuffing some of its data into images: http://whew100.de/mybib.html

    I can't get a description of all the options of phpThumb. When placing the images and putting text with custom fonts on it, I figured out many of the options. But some are missing. For example: I know how to center the text, but I cant position it 40px from left and 80px from top.

    Is there any pdf or similar available that contains all options? Or else: does anyone know the answer to my question?

    Best regards,

    Guido
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      http://www.belafontecode.com/image-manipulation-with-phpthumbof-in-modx-revolution/
      [[*tvImage:phpthumbof=`w=120&h=120&zc=1&fltr[]=gray&fltr[]=wmt|Belafonte Code|3|T|FFFFFF||100|20|0||0|`]]


      https://github.com/JamesHeinrich/phpThumb/blob/master/docs/phpthumb.readme.txt

      "wmt" (WaterMarkText)
               [ex: &fltr[]=wmt|<t>|<s>|<a>|<c>|<f>|<o>|<m>|<n>|<b>|<O>|<x>]
               where:
               <t> is the text to use as a watermark;
                   URLencoded Unicode HTMLentities must be used for
                     characters beyond chr(127). For example, the
                     "eighth note" character (U+266A) is represented
                     as "♪" and then urlencoded to "%26%239834%3B"
                   Any instance of metacharacters will be replaced
                   with their calculated value. Currently supported:
                     ^Fb = source image filesize in bytes
                     ^Fk = source image filesize in kilobytes
                     ^Fm = source image filesize in megabytes
                     ^X  = source image width in pixels
                     ^Y  = source image height in pixels
                     ^x  = thumbnail width in pixels
                     ^y  = thumbnail height in pixels
                     ^^  = the character ^
               <s> is the font size (1-5 for built-in font, or point
                   size for TrueType fonts);
               <a> is the alignment (one of BR, BL, TR, TL, C, R, L,
                   T, B, * where B=bottom, T=top, L=left, R=right,
                   C=centre, *=tile);
                   note: * does not work for built-in font "wmt"
                   *or*
                   an absolute position in pixels (from top-left
                   corner of canvas to top-left corner of overlay)
                   in format {xoffset}x{yoffset} (eg: "10x20")
               <c> is the hex color of the text;
               <f> is the filename of the TTF file (optional, if
                   omitted a built-in font will be used);
               <o> is opacity from 0 (transparent) to 100 (opaque)
                   (requires PHP v4.3.2, otherwise 100% opaque);
               <m> is the edge (and inter-tile) margin in percent;
               <n> is the angle
               <b> is the hex color of the background;
               <O> is background opacity from 0 (transparent) to
                   100 (opaque)
                   (requires PHP v4.3.2, otherwise 100% opaque);
               <x> is the direction(s) in which the background is
                   extended (either 'x' or 'y' (or both, but both
                   will obscure entire image))
                   Note: works with TTF fonts only, not built-in
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 37242 ☆ A M B ☆
        • 339 Posts
        Susan, thank you again! If i get this correct, I cant align a text to the right side while positioning i.e. 40 pixels from top and 80 from the side, right?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I have no idea. I just found the documentation.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 16277 ☆ A M B ☆
            • 19 Posts
            Not sure but this may be of some use. I have this code running on a site using pthumb / Resizer instead of phpThumb, but Resizer uses pretty much the same parameters as phpThumb for watermarking:

            <a href="[[+image:pthumb=`fltr[]=wmt|WATERMARK TEXT|22|[[+wmarkpos]]|FFFFFF|/fonts/Oswald-Bold.ttf|[[+wmarkfade]]|40|0||0|`]]" title="[[+title]]" class="brick-link lightbox" rel="home">
            


            The [[+wmarkpos]] (MIGX) placeholder positions it according to a listbox TV with these values:

            Centre==c||Top==t||Bottom==b||Left==l||Right==r||Top Left==tl||Top Right==tr||Bottom Left==bl||Bottom Right==br
            


            and the value '40' places it 40px from the respective edge.

            I can't correctly recall but I think I got here by adapting an example from this page:

            http://phpthumb.sourceforge.net/demo/demo/phpThumb.demo.demo.php
              • 37242 ☆ A M B ☆
              • 339 Posts
              Hi and thank you for your input!

              The thing is: you can either say "top right" OR "40px from top and 80px from left".

              You can not say "please align the text to the right and place it 40px from top and 80px from the right end of the base image". So if I align names of different sizes to the right side, they either cant be positioned exactly or they run over the end of the image, if its a long name.
                • 37242 ☆ A M B ☆
                • 339 Posts
                I found additional Info and a demo page where the code is actually working:
                https://kekocity.com/uploads/demo/phpThumb.demo.demo.php