private function upload($imagesNum = 1)
 {
     $hash = new Unsee_Hash();
     for ($x = 1; $x <= $imagesNum; $x++) {
         $image = new Unsee_Image($hash);
         $image->setFile(TEST_DATA_PATH . '/images/good/1mb.jpg');
     }
     $hash->expireAt(time() + 100);
     return $hash;
 }
示例#2
0
 public function __construct(Unsee_Hash $hash, $imgKey = null)
 {
     $newImage = is_null($imgKey);
     if ($newImage) {
         $imgKey = uniqid();
     }
     parent::__construct($hash->key . '_' . $imgKey);
     if ($newImage) {
         $keys = Unsee_Image::keys($hash->key . '*');
         $this->num = count($keys);
         $this->expireAt(time() + $hash->ttl());
     }
     $this->setSecureParams();
 }
示例#3
0
 /**
  * Sets the TTL for the provided hash
  * @param Unsee_Hash $hashDoc
  * @return boolean
  */
 private function setExpiration($hashDoc)
 {
     // Custom ttl was set
     if (!empty($_POST['time']) && in_array($_POST['time'], Unsee_Hash::$ttlTypes)) {
         $amount = array_search($_POST['time'], Unsee_Hash::$ttlTypes);
         if ($amount > 0) {
             // Disable single view, which is ON by default
             $hashDoc->max_views = 0;
             $hashDoc->ttl = $_POST['time'];
             // Expire in specified interval, instead of a day
             $hashDoc->expireAt(time() + $amount);
         }
     }
     return true;
 }