We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7923
    • 4,213 Posts
    Attatched image size is 0kb, corrupted?


      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
      • 12110
      • 122 Posts
      This is the complete path to the image:

      http://www.impuls-event.de/modx/assets/images/gtext_6f77533cc52405c56cf2e9283fdd1a5c.gif

      If you surf the pages (only subnavi on the left) at

      http://www.impuls-event.de/modx/index.php?id=3

      you get other examples of this "justifiying ??" effect. Thx again!

      EDIT:

      I changed these values in the snippet, maybe it’s also possible by defining them when calling the snippet, but there were no examples - now it seems to be okay:

       $this->horz="left";       //horiaontal position (left,center,right)
       $this->vert="center";       //vertical position (top,center,bottom)
       $this->just="left";       //text lines justification (left,center,right)
        • 14779
        • 256 Posts
        I am trying to implement Gtext in my template Like This:

        <div id="header">

        <h1><a href="[~[(site_start)]~]" title="[(site_name)]"><img alt="[(site_name)]" src="[[gtext? &font=`rage.ttf` &fontsize=`18` &color=`#ffffff` &bgcolor=`#000000` &text=`[(site_name)]`]]" /></a></h1>
        </div>
        <!-- close #header -->

        I have uploaded the font to /assets/files/fonts.

        I am getting this error:


        « MODx Parse Error »
        MODx encountered the following error while attempting to parse the requested resource:
        « PHP Parse Error »

        PHP error debug
        Error: imagettfbbox(): Could not find/open font
        Error type/ Nr.: Warning - 2
        File: /homepages/7/d165971201/htdocs/manager/includes/document.parser.class.inc.php(705) : eval()’d code
        Line: 208

        Parser timing
        MySQL: 0.0066 s s (3 Requests)
        PHP: 0.0699 s s
        Total: 0.0764 s s

        How can I fix This?
          PM me to find out how you can get a FREE ipad 2!
          • 14779
          • 256 Posts
          Is there any way Gtext can generate transparent backgrounds?
            PM me to find out how you can get a FREE ipad 2!
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            It looks like the snippet doesn’t, but the atextimage class that is used allows you to open an existing file and use that as the background, and you can use an existing image that is nothing but a transparent .gif or .png, as you can see from the atextimage demo page (select the blanktrans.gif as the background).

            http://www.gaclarke.com/atextimage/demoform.php

            So it shouldn’t be difficult to add another parameter containing the name of the image to use to the snippet call, and use it internally to use the CreateImage($ipath) function instead of the MakeImage($iw=0,$ih=0) function.

            Or, you could add the imagecolortransparent function:

            http://il.php.net/manual/en/function.imagecolortransparent.php

            Transparent GIF w/ text from TTF Font
            -------------------------------------
            $image = imagecreatetruecolor(192, 36);
            $trans_color = imagecolorallocate($image, 255, 0, 0);
            $color = imagecolorallocate($image, 255, 255, 255);
            imagecolortransparent($image, $trans_color);
            imagettftext($image, 10, 0, 10, 23, $color, "impact.ttf", " MENU ITEM");
            imagegif($image, "output.gif");
            imagedestroy($image);
            
              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
              • 14779
              • 256 Posts
              If I was to use an existing transparent .gif, should it be the same size that The finished product needs to be? Or can it be like a single pixel?
                PM me to find out how you can get a FREE ipad 2!
                • 7923
                • 4,213 Posts
                You could also take a look at the Text2PNG snippet by Susan (sottwell).. It generates transparent images. Then you just need to use it together with the PNG plugin in MODx what enables transparent PNGs in IE.


                  "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Did I do that? I vaguely remembered that there was one that did transparencies, but didn’t remember doing it.
                    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
                    • 7923
                    • 4,213 Posts
                    Hehe, probably did it in your sleep.. grin


                      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                      • 14779
                      • 256 Posts
                      What is the usage for Text2PNG?
                        PM me to find out how you can get a FREE ipad 2!