Example #1
0
 /**
  * Constructor: sets the url and path properties based on the arguments
  *
  * @param File $file (optional) A File entity from which we'll calculate the
  *   thumbnail url and path.
  */
 public function __construct(File $file = NULL)
 {
     $this->setDefault();
     if ($file) {
         if (!$file->exists()) {
             $this->setMissing();
         } elseif ($file->isImage()) {
             $this->url = rtrim($file->getUploadDestination()->url, '/') . '/_thumbs/' . rawurlencode($file->file_name);
             $this->path = rtrim($file->getUploadDestination()->server_path, '/') . '/_thumbs/' . rawurlencode($file->file_name);
         }
     }
 }