2 Replies Latest reply on Mar 26, 2010 10:31 AM by tb0nus

    Conditionally resize images - error

    tb0nus

      I am trying to conditionally resize images based on their pixel range but when I run my script all my images are sizing down to 900 pixels, regardless of size.

       

      I think my conditional is incorrectly written,  can someone help me out

       

      Thanks!

      TK

       

      #target photoshop
      app.bringToFront();

       

      function fitImage(newImgSize) {


      var  doc=activeDocument;


      if (doc.width > doc.height)  {doc.resizeImage(newImgSize, null, null, ResampleMethod.BICUBICSHARPER);}
      if (doc.width < doc.height)  {doc.resizeImage(null, newImgSize, null,ResampleMethod.BICUBICSHARPER);}
      if (doc.width == doc.height)  {doc.resizeImage(newImgSize, newImgSize, null,  ResampleMethod.BICUBICSHARPER);}

       

      }


      var doc =  app.activeDocument;

       

      if (parseInt(doc.height,  10) > '1200px') {fitImage (1800,300);}

       

      else if  (parseInt(doc.width, 10) > '1200px') {fitImage (1800,300);}

       

      else  {fitImage (900,300);}