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
    It’s definitely something server specific, because the snippet has ~ 6700 downloads and not very many get this error..

    Try changing lines 371 - 378 in maxigallery.php from:
    					move_uploaded_file( $_FILES['file'.$i]['tmp_name'] , $mg->path_to_gal.$name );
    					chmod($mg->path_to_gal.$name,0666);
    					
    					$handleMessage = $mg->handleFile($name, $modx->db->getRecordCount($rsx));
    					if ($handleMessage != "") {
    						$manageOuterTplData['messages'] .= $handleMessage;
    						$upload_error = true;
    					}
    

    to:
    				if(move_uploaded_file( $_FILES['file'.$i]['tmp_name'] , $mg->path_to_gal.$name )) {
        					chmod($mg->path_to_gal.$name,0666);
        					
        					$handleMessage = $mg->handleFile($name, $modx->db->getRecordCount($rsx));
        					if ($handleMessage != "") {
        						$manageOuterTplData['messages'] .= $handleMessage;
        						$upload_error = true;
        					}
    				}
    


    EDIT:
    And try changing the chmod line from:
    chmod($mg->path_to_gal.$name,0666);
    

    to:
    chmod($modx->config['base_path'].$mg->path_to_gal.$name,0666);
    

    And you can also try to add the $modx->config[’base_path’] to the move_uploaded_file function call


      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
      • 32093
      • 21 Posts
      Hey Doze, that last change worked!!!

      I just did the first piece of code, not the CHMOD one and all is fine now.

      Thanks a million for helping me with this.

      Loving Maxigallery again! grin
        • 30821
        • 13 Posts
        it worked for me also, without using ftp commands. only changing the lines 371-378.

        thanks doze!!!

        /j
          • 7923
          • 4,213 Posts
          Okay, good.. I’ll make sure that it gets to the next release too..


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 29703
            • 217 Posts
            Just a note to say this solved my problem, which I originally thought was to do with the Zeus web server.

            http://modxcms.com/forums/index.php/topic,21996.0.html

            Thanks! Lifesaver.
              • 7923
              • 4,213 Posts
              Good stuff, Could you also note it in your other thread too that it’s solved with this.. Thanks!


                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 6726
                • 7,075 Posts
                I am facing the same issue with my dedicated box (config in my signature), and the fixes above don’t work for me, but I have to make sure it’s not related to other issues I am having before confirming this...

                Plus I’ll ask Perrine since we have the same config and I know she has galleries running fine...
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l'outil id
                  • 6726
                  • 7,075 Posts
                  Now that I’ve cleaned up things in my Maxigallery templates, and applied the above fix + the fix for resynchronize duplicate, there is no function.chmod error.

                  But I still encounter one error, which only occurs when I have uploaded via a FTP client and tried to re-synchronize the gallery :

                  « MODx Parse Error »
                  MODx encountered the following error while attempting to parse the requested resource:
                  « PHP Parse Error »
                   
                  PHP error debug
                    Error: 	imagejpeg() [function.imagejpeg]: Unable to open 'assets/galleries/834/1111941704_69459716.jpg' for writing: Permission non accordée	 
                    Error type/ Nr.: 	Warning - 2	 
                    File: 	/home/*****/domains/*****/public_html/assets/snippets/maxigallery/watermark/Thumbnail.class.php	 
                    Line: 	331	 
                    Line 331 source: 	imageJPEG($this->img["des"],"$save",$this->quality); 	 
                   


                  Anyway this can be fixed ?

                  It would seem you can’t use chown remotely

                  Note: This function will not work on remote files as the file to be examined must be accessible via the servers filesystem.

                  http://us.php.net/manual/en/function.chown.php
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l'outil id
                    • 7923
                    • 4,213 Posts
                    You would need to manually change the ownership of the files that are uploaded via FTP first to the one that is used by php before you do the re-synchronize thing..


                      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                      • 9060
                      • 17 Posts
                      Very good excellent work!
                        ERSAO