Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1.     public function importFromDisk ( $file, $bTrim=false, $hash=NULL )
  2.     {
  3.         // INCOMING is set in /index.php -- creates a temporary, working filename to be used to create thumbnails
  4. //      echo 'hash: ' . ( is_null( $hash ) ? self::generateHash( basename( $file ) ) : $hash ) . '<BR>';
  5.         $this->working = INCOMING . '/' . ( is_null( $hash ) ? self::generateHash( basename( $file ) ) : $hash );
  6. //      echo $this->working.'<BR>';
  7.        
  8.         if ( file_exists($this->working) ) // does it already exist?
  9.             unlink($this->working); // remove file
  10.  
  11.        
  12.         if ( false === copy( $file, $this->working ) )
  13.         {
  14.             $this->working = NULL;
  15.             throw new Exception('Unable to read file from disk');
  16.         }
  17.    
  18.         // do we want to trim this image on import?
  19.         if ( $bTrim )
  20.             self::trimimage( $this->working );
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement