We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19968
    • 5 Posts
    hi, i recently downloaded and installed maxigallery.
    my page show the "manage pictures" button, but when i try to upload an image i get this error:

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

    PHP error debug
    Error: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions
    Error type/ Nr.: Warning - 2
    File: C:\Programmi\xampp\htdocs\ex\dev\assets\snippets\maxigallery\watermark\Thumbnail.class.php
    Line: 354
    Line 354 source: $this->img["des"] = ImageCreateTrueColor($X_des,$Y_des);


    i have the gd library version 2 up and working fine (used with other scripts):

    gd
    GD Support enabled
    GD Version bundled (2.0.28 compatible)
    FreeType Support enabled
    FreeType Linkage with freetype
    FreeType Version 2.1.9
    T1Lib Support enabled
    GIF Read Support enabled
    GIF Create Support enabled
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled
    XBM Support enabled


    the same problem was issued by qnick in this post http://modxcms.com/forums/index.php/topic,3843.msg31931/topicseen.html#msg31931, but i could find no solutions in this or other topics.
    i tried to upload jpg, gif and png files (max 20KB) all with the same result: the script uploads the image, but can’t create the thumbnail.
    (it really seems a problem with the gd library, but as i already said it is working fine with other scripts)

    i use mod x version 0.9.2.1, maxigallery version 0.4.1, php 5.1.4 on a localhost server (windows 2000 pro)

    can someone help me, please?
    thank you
      • 7923
      • 4,213 Posts
      Yes, I remember this issue, and I could not resolve it. Could you try the attached functions.php file to see if it’s helps (rename from mg_functions.txt to functions.php)..


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 19968
        • 5 Posts
        hello. thanks for the reply.
        unfortunately, your attached file returns the same error.
          • 7923
          • 4,213 Posts
          Yea, that was a longshot anyways.. wink but to me it seems that getimagesize() function can’t get the size of the picture and that’s why it fails, not sure though without debugging it onsite. It can be a permission issue.. what does your assets/galleries folder look like when you upload a image? and how’s the permissions..?


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 19968
            • 5 Posts
            well, it is win2000, so there should be no permissions for the folder. i just created it with "new folder" and i’m the administrator of the computer.
            and, if i understood well what you are asking, when i try to upload an image the "galleries" folder creates a new folder named with a number (it is like the id of the modx page where the gallery is) and uploads the image, while it breaks with the thumbnail. it don’t think it is a permission problem, because it is a win and because it works until the thumbnail.
            thank you.
              • 19968
              • 5 Posts
              hi again. i got exactly the same error on my remote server (linux), where gd2 is always updated and where i gave 777 permission to the galleries folder: again it creates the folder, uploads the file and breaks with
              error: imagecreatetruecolor(): Invalid image dimensions

              same also on a winXp home in localhost
                • 19968
                • 5 Posts
                ok. now i’m trying to upload a jpg file 240 x 180 px.
                in modx, when i call the snippet, i set "&max_thumb_size=’120’ ".

                in "watermark/Thumbnail.class.php" at lines 209-228 we have the function "size_height".
                at line 211 i ask to echo $this->img["y_thumb"]. the result is ’120’ (with the ’ ’ ), so, i think, at line 223 ($this->img["x_thumb"] = ($this->img["y_thumb"]/$this->img["y"])*$this->img["x"];) it is impossible to find the x_thumb, because of the ’ .

                so i tried to call the snippet in this way: "&max_thumb_size=120 " (without the ’ ) and it works.

                it remains a mistery to me why i reported this error and the other users didn’t.
                but maybe you can halp to find this out. thank you.
                  • 7923
                  • 4,213 Posts
                  Oh, well that figures.. You can’t use quotes in snippet calls, they have to be backticks. E.g. not ’ but `


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."