22 Replies Latest reply on Mar 10, 2018 5:27 AM by r-bin

    problem image preview

    geppettol66959005 Level 3

      I have a problem with image preview

      use mac with high sierra

      with photoshop cc2014 everything ok works properly

      Schermata 2018-03-09 alle 09.53.07.png

       

      instead in photoshop 2018 I get out error

       

      Schermata 2018-03-09 alle 10.06.35.png

       

      where am I wrong?

       

      // script

       

      function main(){  
      inputFolder = Folder.selectDialog("SELECT FOLDER IMAGE:");  
      var fileList = inputFolder.getFiles(/\.(jpg|png)$/i);  
      Image.prototype.onDraw = function(){
          
          
          
      // "this" is the container; "this.image" is the graphic  
      if( !this.image ) return;  
      var WH = this.size,  
      wh = this.image.size,  
      k = Math.min(WH[0]/wh[0], WH[1]/wh[1]),xy;  
      // Resize proportionally:  
      wh = [k*wh[0],k*wh[1]];  
      // Center:  
      xy = [ (WH[0]-wh[0])/2, (WH[1]-wh[1])/2 ];  
      this.graphics.drawImage(this.image,xy[0],xy[1],wh[0],wh[1]);  
      WH = wh = xy = null;  
      }  
      var win = new Window ("dialog", "PREVIEW");  
      win.pnl1 = win.add('panel', undefined, undefined, {borderStyle:'black'});  
      win.pnl1.preferredSize=[400,400];  
      win.Im1 = win.pnl1.add ("image", undefined,fileList[0]);  
      win.Im1.size = [400,400];  
      
      
      
      
      
      
      win.pnl2 = win.add('panel', undefined, undefined, {borderStyle:'black'});  
      win.pnl2.orientation = "row";
      win.pnl2.bu2 = win.pnl2.add('button',[110,10,200,30],'BACK'); 
      win.pnl2.bu1 = win.pnl2.add('button',[10,10,100,30],'NEXT');  
      
      
      
      
      
      
      var PIC = 0;  
      win.pnl2.bu1.onClick=function(){  
      //Next picture  
      if(PIC == fileList.length -1) return;  
      PIC++;  
      win.Im1.image = fileList[PIC];  
          }  
      win.pnl2.bu2.onClick=function(){  
      //Previous  
      if(PIC == 0 ) return;  
      PIC--;  
      win.Im1.image = fileList[PIC];  
          }  
      win.show();  
      }  
      main();