We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30100
    • 58 Posts
    On our site, we would like users to be able to upload images directly from their digital camera with TinyMCE and MCPUK to be able to crop them and use them on their homepage.

    The problem is that somewhere after 3 250 000 pixels in an image MCPUK (FCKEditor) stops generating thumbnails for the image and croping and resizing the image in the editor stops working. On our page we are using DirectResize that is a grate plugin but onely works with images smaller than somewhere 800 000 pixels.

    All this is fine since we are not intrested in larger pictures than 1024x768 pixels, but how do we make a script for MCPUK that rezises images to 1024x768 on file upload?

    A plus would be if jpeg’s that are rotated by the camera gets properly rotated on file upload.

    This would be a great function to ease file upload for users that don’t know much of computers or if you wish to upload images if you are on an internet cafe with your digital camera etc, where you don’t have the software or time to resize the images manually.

    Please share some ideas. smiley

    *edit* Are there any other GPL browsers that does this?
      • 17883
      • 1,039 Posts
      There is a system event called "OnFileManagerUpload", perhaps it’s possible to hook in with a plugin and resize the file if it is an image? That wouldn’t effect uploads via TinyMCE but would be a starting point.

        • 30100
        • 58 Posts
        Thanks, a system event would be possible if it was inside MODx but sadly this is not the case...

        I’m hoaping that others have had this problem and solved some how...
          • 19427
          • 6 Posts
          This would indeed be very interesting wink
            • 30100
            • 58 Posts
            Are there no people here that knows how to make mcpuk autoresize images on file upload. I have created some code that should be able to resize the images, but I need to figure out how to hook it up to mcpuk. I’m trying to figure FileUpload.php but I can’t seem to find where to place the code... and how to implement it.

            	function resize($img_name) {
            		// Load image and get image size
            		$img = imagecreatefromjpeg($img_name);
            		
            		$width = imagesx( $img );
            		$height = imagesy( $img );
            
            		// Calculate new size
            		if ($width*$height>786432) {
            			$ratio=($height*100)/$width;
            			if ($ratio>=100) {	//Portrait or square
            				$new_height=1024;
            				$new_width=(1024*$ratio)/100;
            			}
            			else {	//Landscape
            				$new_width=1024;
            				$new_height=(1024*$ratio)/100;
            			}
            		}
            
            		// Create a new temporary image
            		$tmp_img = imagecreatetruecolor( $new_width, $new_height );
            
            		// Copy and resize old image into new image
            		imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
            		
            		// Save thumbnail into a file
            		imagejpeg( $tmp_img, $img_name );
            	}
              • 21193
              • 9 Posts
              Nobody have a solution for this?
              The problem is that no thumbnail is created when the image is greater than 2 MB. I did changes the settings in php.ini, and the limitation seems to be in the resources explorer itself.

              Please help! Thanks