Re: Max Image Size..

  •  02-11-2013, 8:42 PM

    Re: Max Image Size..

    Ken,

    Thanks for the response. The fuction is exactly what I needed.

     

    For other following in my footsteps here is what I did with it.

    Since my application was not concerned about height but only width, I adjusted it to suit my needs and pasted the changes below.

    Now if an image is wider then my column (600 in my case), it will resize it porportionatly both by figuring out how much wider the image is then my limit and subtracting that amount from both the width and height. It is now doing exactly what I was hoping for.

     

    <script> 
    function CuteEditor_FilterHTML(editor,code)    
    {    
        var editdoc = editor.GetDocument(); 
        for(var i=0;i<editdoc.images.length;i++) 
        { 
            if(editdoc.images[i].width>600) 
            { 
                 var currwidth = editdoc.images[i].width
                 var makelessby = currwidth - 600
                 editdoc.images[i].width= currwidth - makelessby  
                     var currheight =  editdoc.images[i].height

                     if(currheight > makelessby)

                      {

                            currheight = currheight - makelessby

                            editdoc.images[i].height = currheight

                      }
      } 
        } 
        return code; 
    }    
    function CuteEditor_FilterCode(editor,code)    
    {    
             var editdoc = editor.GetDocument(); 
        for(var i=0;i<editdoc.images.length;i++) 
        { 
            if(editdoc.images[i].width>600) 
            { 
               var currwidth = editdoc.images[i].width
       var makelessby = currwidth - 600
       editdoc.images[i].width= currwidth - makelessby 

                     var currheight =  editdoc.images[i].height

                     if(currheight > makelessby)

                      {

                            currheight = currheight - makelessby

                            editdoc.images[i].height = currheight

                     }

          }  
        } 
        return code; 

    </script>


    Self praise is no recommendation
View Complete Thread