Ejemplo n.º 1
0
 public function get_default_image($id, $options = [])
 {
     /** @var image_size $image_size */
     $image_size = new image_size();
     $image_size->do_retrieve([], $options);
     if ($image_size->get_primary_key()) {
         $file = '/uploads/' . $this->parent_form->get_table_class() . '/' . $this->fid . '/' . $id . '_' . $image_size->reference . '.' . $image_size->get_format();
         if (file_exists(root . $file)) {
             return node::create('img', ['src' => $file]);
         }
     }
     return node::create('span', [], 'No Image');
 }
Ejemplo n.º 2
0
 protected function do_process_image($source, image_size $size)
 {
     $ext = pathinfo($source, PATHINFO_EXTENSION);
     $resize = new image_resizer($source);
     $resize->resizeImage($size->max_width, $size->max_height, $size->icid == 1 ? true : false);
     $resize->saveImage(str_replace('.' . $ext, '', $source) . '_' . $size->reference . '.' . $size->get_format());
 }