Esempio n. 1
0
 public function resize()
 {
     $md5 = md5_file($this->file);
     $newresized = IMAGES . SL . 'booru' . SL . 'resized' . SL . $md5 . '.jpg';
     $this->worker = Transform_Image::get_worker($this->file);
     $this->animated = $this->is_animated($this->file);
     $resized = $this->check_resize($newresized);
     return $resized;
 }
Esempio n. 2
0
 protected function process()
 {
     global $key;
     $newthumb = '/var/www/frontend/demo/art/_' . $key . '.jpg';
     $this->worker = Transform_Image::get_worker($this->file);
     $this->animated = $this->is_animated($this->file);
     $this->scale(array(150, 150), $newthumb);
     $this->set(array());
 }
Esempio n. 3
0
 protected function process()
 {
     $thumb = md5(microtime(true));
     $newthumb = IMAGES . SL . 'avatar' . SL . $thumb . '.jpg';
     chmod($this->file, 0755);
     $this->worker = Transform_Image::get_worker($this->file);
     $this->animated = $this->is_animated($this->file);
     $this->scale(array(Config::get('avatar', 'width'), Config::get('avatar', 'height')), $newthumb);
     $this->set(array('thumb' => $thumb));
 }
Esempio n. 4
0
 protected function process()
 {
     $time = str_replace('.', '', microtime(true));
     $extension = strtolower(pathinfo($this->name, PATHINFO_EXTENSION));
     $newfile = IMAGES . SL . 'news' . SL . 'full' . SL . $time . '.' . $extension;
     $newthumb = IMAGES . SL . 'news' . SL . 'thumb' . SL . $time . '.jpg';
     chmod($this->file, 0755);
     if (!move_uploaded_file($this->file, $newfile)) {
         file_put_contents($newfile, file_get_contents($this->file));
     }
     $this->worker = Transform_Image::get_worker($newfile);
     $this->scale(array(0 => 200, 1 => 150), $newthumb);
     $this->set(array('success' => true, 'image' => SITE_DIR . '/images/news/thumb/' . $time . '.jpg', 'data' => $time . '.' . $extension));
 }
Esempio n. 5
0
 protected function process()
 {
     $pathinfo = pathinfo($this->name);
     if (!file_exists(IMAGES . SL . 'small' . $pathinfo['dirname'])) {
         mkdir(IMAGES . SL . 'small' . $pathinfo['dirname']);
     }
     if (!file_exists(IMAGES . SL . 'full' . $pathinfo['dirname'])) {
         mkdir(IMAGES . SL . 'full' . $pathinfo['dirname']);
     }
     $newthumb = IMAGES . SL . 'small' . $pathinfo['dirname'] . SL . $pathinfo['filename'] . '.jpg';
     chmod($this->file, 0755);
     $this->worker = Transform_Image::get_worker($this->file);
     $this->animated = false;
     if ($this->info[0] > Config::get('card', 'full_width')) {
         $this->scale(array(Config::get('card', 'full_width'), Config::get('card', 'full_height')), IMAGES . SL . 'full' . SL . $this->name);
     } else {
         copy($this->file, IMAGES . SL . 'full' . SL . $this->name);
     }
     $this->scale(array(Config::get('card', 'width'), Config::get('card', 'height')), $newthumb);
 }
Esempio n. 6
0
 protected function process()
 {
     $md5 = md5_file($this->file);
     $extension = strtolower(pathinfo($this->name, PATHINFO_EXTENSION));
     $newname = $md5 . '.' . $extension;
     $newfile = IMAGES . SL . 'board' . SL . 'full' . SL . $newname;
     chmod($this->file, 0755);
     if (!file_exists($newfile)) {
         if (!move_uploaded_file($this->file, $newfile)) {
             file_put_contents($newfile, file_get_contents($this->file));
         }
     }
     $thumb = md5(microtime(true));
     $newthumb = IMAGES . SL . 'board' . SL . 'thumbs' . SL . $thumb . '.jpg';
     $this->worker = Transform_Image::get_worker($newfile);
     $width = $this->worker->get_image_width();
     $height = $this->worker->get_image_height();
     $this->scale(array(def::board('thumbwidth'), def::board('thumbheight')), $newthumb);
     $this->set(array('success' => true, 'image' => SITE_DIR . '/images/board/thumbs/' . $thumb . '.jpg', 'data' => $newname . '#' . $thumb . '.jpg#' . $this->size . '#' . $width . 'x' . $height, 'full' => $newname, 'thumb' => $thumb, 'size' => $this->size, 'width' => $width, 'height' => $height));
 }
Esempio n. 7
0
 protected function scale_animated($new_size, $target)
 {
     $worker = $this->worker;
     $old_x = $worker->get_image_width();
     $old_y = $worker->get_image_height();
     $this->sizes = $old_x . 'x' . $old_y;
     $aspect = !empty($new_size) ? $new_size[0] / $old_x : 1 / 2;
     $x = round($old_x * $aspect);
     $y = round($old_y * $aspect);
     do {
         $worker->scale_image($x, $y, 1);
     } while ($worker->next_image());
     $worker = $worker->deconstruct_images();
     $target = preg_replace('/\\.jpe?g$/i', '.gif', $target);
     $worker->write_images($target, true);
     $worker->clear();
     $this->worker = Transform_Image::get_worker($target);
     return true;
 }