Exemple #1
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * input
      */
     if (is_numeric($_POST['customer_id'])) {
         $customer_id = $_POST['customer_id'];
     } else {
         $customer_id = 0;
     }
     /**
      * bo users list
      */
     require_once 'models/client/client_customer.php';
     $Customer = new client_customer();
     $bo_users_list = $Customer->getCustomersWithRole();
     foreach ($bo_users_list as $customer) {
         $this->tpl->assign('CUSTOMER', $customer);
         if ($customer['id'] == $customer_id) {
             $this->tpl->assign('SELECTED', 'selected="selected"');
         } else {
             $this->tpl->assign('SELECTED', '');
         }
         $this->tpl->parse('content.item');
     }
     /**
      * stats
      */
     $author_stats = array();
     /**
      * common_node
      */
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $author_stats['common_node'] = $Node->getAuthorStats($customer_id);
     /**
      * common_image
      */
     require_once 'models/common/common_image.php';
     $Image = new common_image();
     $author_stats['common_image'] = $Image->getAuthorStats($customer_id);
     /**
      * common_revision
      */
     require_once 'models/common/common_revision.php';
     $Revision = new common_revision();
     $author_stats['common_revision'] = $Revision->getAuthorStats($customer_id);
     /**
      * assign
      */
     $this->tpl->assign('AUTHOR_STATS', $author_stats);
     return true;
 }
Exemple #2
0
 /**
  * main action
  */
 public function mainAction()
 {
     header('Content-Type: text/xml');
     // flash in IE with SSL dont like Cache-Control: no-cache and Pragma: no-coche
     header("Cache-Control: ");
     header("Pragma: ");
     require_once 'models/common/common_image.php';
     $Image = new common_image();
     //$images = $Image->listing("role='{$this->GET['role']}' AND node_id={$this->GET['node_id']}", "priority DESC, id ASC");
     $images = $Image->listing("node_id={$this->GET['node_id']}", "priority DESC, id ASC");
     foreach ($images as $img) {
         $this->tpl->assign('IMAGE', $img);
         $this->tpl->parse("content.item");
     }
     return true;
 }
Exemple #3
0
 /**
  * post
  */
 function post()
 {
     parent::post();
     /* we need to include config, can be removed when we initialize all conf on beggining */
     require_once 'models/common/common_image.php';
     $common_image_conf = common_image::initConfiguration();
     $this->tpl->assign('IMAGE_CONF', $common_image_conf);
     //TODO?: images size can be extracted from COMMON_IMAGE_THUMBNAIL
     /**
      * cycle gallery options
      */
     if ($this->node_data['component']['template'] == 'cycle') {
         if (!$this->node_data['component']['cycle']['fx']) {
             $this->node_data['component']['cycle']['fx'] = $common_image_conf['common_image']['cycle_fx'];
         }
         if (!$this->node_data['component']['cycle']['easing']) {
             $this->node_data['component']['cycle']['easing'] = $common_image_conf['common_image']['cycle_easing'];
         }
         if (!is_numeric($this->node_data['component']['cycle']['timeout']) || $this->node_data['component']['cycle']['timeout'] < 0) {
             $this->node_data['component']['cycle']['timeout'] = $common_image_conf['common_image']['cycle_timeout'];
         }
         if (!is_numeric($this->node_data['component']['cycle']['speed']) || $this->node_data['component']['cycle']['speed'] < 0) {
             $this->node_data['component']['cycle']['speed'] = $common_image_conf['common_image']['cycle_speed'];
         }
         $this->tpl->assign("SELECTED_cycle_fx_{$this->node_data['component']['cycle']['fx']}", "selected='selected'");
         $this->tpl->assign("SELECTED_cycle_easing_{$this->node_data['component']['cycle']['easing']}", "selected='selected'");
         //must assign NODE before parsing
         $this->tpl->assign("NODE", $this->node_data);
         $this->tpl->parse('content.cycle_options');
     }
     /**
      * local templates
      */
     $this->displayLocalImageGalleryTemplates();
     /**
      * template selected
      */
     $this->tpl->assign("SELECTED_template_{$this->node_data['component']['template']}", "selected='selected'");
 }
Exemple #4
0
 /**
  * resize
  */
 static function resize($file, $required_width, $required_height = false, $method = 'extent', $gravity = 'center', $fill = false)
 {
     //first check file exists and is readable
     if (!is_readable(ONXSHOP_PROJECT_DIR . $file)) {
         return false;
     }
     //prepare variables
     if (is_numeric($required_height)) {
         $directory = ONXSHOP_PROJECT_DIR . "var/thumbnails/{$required_width}x{$required_height}";
         $thumb_file = "var/thumbnails/{$required_width}x{$required_height}/" . md5($file);
     } else {
         $directory = ONXSHOP_PROJECT_DIR . "var/thumbnails/{$required_width}";
         $thumb_file = "var/thumbnails/{$required_width}/" . md5($file);
     }
     $file_rp = ONXSHOP_PROJECT_DIR . $file;
     $image_resize_options = "_{$method}_{$gravity}_{$fill}";
     // TODO check valid options
     if ($image_resize_options == "___") {
         $image_resize_options = "";
     }
     if ($image_resize_options) {
         $thumb_file = $thumb_file . $image_resize_options;
     }
     $thumb_file_rp = ONXSHOP_PROJECT_DIR . $thumb_file;
     //check if the destination directory exits
     if (!is_readable($directory)) {
         if (!mkdir($directory)) {
             msg("common_image.resize(): Cannot create folder {$directory}", 'error');
         }
     }
     //determinate real image size
     $size = common_image::getImageSize($file_rp);
     $width = $required_width;
     $height = round($required_width / $size['proportion']);
     msg("Thumbnail will have size {$width} x {$height}", 'ok', 3);
     /**
      * resize method option
      */
     if (!in_array(strtolower($method), array('crop', 'extent'))) {
         $method = 'extent';
     }
     /**
      * gravity option
      * NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast
      */
     if (!in_array(strtolower($gravity), array('northwest', 'north', 'northeast', 'west', 'center', 'east', 'southwest', 'south', 'southeast'))) {
         $gravity = 'center';
     }
     /**
      * fill option
      */
     if ($fill == true) {
         $fill = '^';
     } else {
         $fill = '';
     }
     /**
      * if height is specified align in center and allow to fill the space
      * see  http://www.imagemagick.org/Usage/thumbnails/#cut
      *      http://www.imagemagick.org/Usage/resize/#shrink
      */
     if (is_numeric($required_height)) {
         $background = common_image::supportsTransparency($file_rp) ? 'none' : 'white';
         $other_im_params = "-background {$background} -alpha background -gravity {$gravity} -{$method} {$width}x{$required_height}";
         $height = $required_height;
     } else {
         $other_im_params = '';
     }
     /**
      * return cached file or create with ImageMagick
      */
     if (is_readable($thumb_file_rp)) {
         return $thumb_file;
     } else {
         $image_configuration = common_image::initConfiguration();
         $jpeg_quality = $image_configuration['jpeg_quality'];
         $file_rp_escaped = escapeshellarg($file_rp);
         $width = (int) $width;
         $height = (int) $height;
         $jpeg_quality = (int) $jpeg_quality;
         $thumb_file_rp_escaped = escapeshellarg($thumb_file_rp);
         //usage: resize $filename $width $height $target_filename $quality $other_options
         ///usr/bin/convert "$1" -colorspace RGB -depth 8 -quality $QUALITY -thumbnail $2x$3^ $6 "$4"
         $colorspace = self::isOldImageMagickVersion() ? 'RGB' : 'sRGB';
         $shell_command = "convert {$file_rp_escaped} -colorspace {$colorspace} -depth 8 -quality {$jpeg_quality} -thumbnail {$width}x{$height}{$fill} {$other_im_params} {$thumb_file_rp_escaped}";
         $result = local_exec($shell_command);
         if (is_readable($thumb_file_rp)) {
             return $thumb_file;
         } else {
             return false;
         }
     }
 }
Exemple #5
0
 /**
  * main action
  */
 public function mainAction()
 {
     /* we need to include config, can be removed when we initialize all conf on beginning */
     require_once 'models/common/common_image.php';
     $common_image_conf = common_image::initConfiguration();
     /**
      * Set input variables
      */
     $relation = preg_replace('/[^a-zA-Z_-]/', '', $this->GET['relation']);
     $role = preg_replace('/[^a-zA-Z_-]/', '', $this->GET['role']);
     if (is_numeric($this->GET['node_id'])) {
         $node_id = $this->GET['node_id'];
     } else {
         $node_id = 0;
     }
     if ($this->GET['limit']) {
         $limit = $this->GET['limit'];
     } else {
         $limit = "";
     }
     /**
      * cycle conf
      */
     $cycle = array();
     if ($this->GET['cycle_fx']) {
         $cycle['fx'] = $this->GET['cycle_fx'];
     } else {
         $cycle['fx'] = 'fade';
     }
     //"'disable'" value must be interpreted as "null"
     if ($this->GET['cycle_easing'] && $this->GET['cycle_easing'] != 'disable') {
         $cycle['easing'] = "'{$this->GET['cycle_easing']}'";
     } else {
         $cycle['easing'] = 'null';
     }
     if (is_numeric($this->GET['cycle_timeout'])) {
         $cycle['timeout'] = $this->GET['cycle_timeout'];
     } else {
         $cycle['timeout'] = 0;
     }
     if (is_numeric($this->GET['cycle_speed'])) {
         $cycle['speed'] = $this->GET['cycle_speed'];
     } else {
         $cycle['speed'] = 2000;
     }
     //cycle_link_to_node_id
     $cycle['link_to_node_id'] = array();
     if ($this->GET['cycle_link_to_node_id'] != '') {
         $cycle_link_to_node_id_items = explode(',', $this->GET['cycle_link_to_node_id']);
         foreach ($cycle_link_to_node_id_items as $cycle_link_to_node_id_item) {
             if (is_numeric($cycle_link_to_node_id_item)) {
                 $cycle['link_to_node_id'][] = $cycle_link_to_node_id_item;
             }
         }
     }
     /**
      * image path
      */
     $img_path = $this->getImagePath();
     /**
      * Find what object we need
      */
     $Image = $this->createImageObject($this->GET['relation']);
     if (is_numeric($this->GET['width'])) {
         $width = $this->GET['width'];
     } else {
         $width = 100;
     }
     if (is_numeric($this->GET['height'])) {
         $height = $this->GET['height'];
     } else {
         $height = false;
     }
     /**
      * initialize variables for extreme dimensions
      */
     $dimension_extreme['width_max'] = 0;
     $dimension_extreme['width_min'] = 0;
     $dimension_extreme['height_max'] = 0;
     $dimension_extreme['height_min'] = 0;
     $dimension_extreme['proportion_max'] = 0;
     $dimension_extreme['proportion_min'] = 10;
     /**
      * Prepare query
      */
     $role = $this->GET['role'] ? "role='{$this->GET['role']}' AND " : '';
     $image_get_query = "{$role} node_id={$node_id}";
     /**
      * Get the list
      */
     $images = $Image->listing($image_get_query, "priority DESC, id ASC", $limit);
     /**
      * Loop through the list
      */
     if (is_array($images)) {
         foreach ($images as $i => $img) {
             $img['path'] = $img_path;
             $img['first_id'] = $images[0]['id'];
             $size = $Image->getImageSize(ONXSHOP_PROJECT_DIR . $img['src']);
             if ($size) {
                 if ($size['width'] > $dimension_extreme['width_max']) {
                     $dimension_extreme['width_max'] = $size['width'];
                 }
                 if ($size['width'] < $dimension_extreme['width_min']) {
                     $dimension_extreme['width_min'] = $size['width'];
                 }
                 if ($size['height'] > $dimension_extreme['height_max']) {
                     $dimension_extreme['height_max'] = $size['height'];
                 }
                 if ($size['height'] < $dimension_extreme['height_min']) {
                     $dimension_extreme['height_min'] = $size['height'];
                 }
                 if ($size['proportion'] > $dimension_extreme['proportion_max']) {
                     $dimension_extreme['proportion_max'] = $size['proportion'];
                 }
                 if ($size['proportion'] < $dimension_extreme['proportion_min']) {
                     $dimension_extreme['proportion_min'] = $size['proportion'];
                 }
                 // deprecated, keep for backward compatibility
                 if (is_numeric($cycle['link_to_node_id'][$i])) {
                     $img['link_to_node_id'] = $cycle['link_to_node_id'][$i];
                 }
                 $this->assignAndParseItem($img);
             }
         }
         $images_count = count($images);
     }
     /**
      * Calculate relative height
      */
     if ($width > 0) {
         $dimension_max['width'] = $width;
         $dimension_max['height'] = $width / $dimension_extreme['proportion_min'];
     } else {
         $dimension_max['width'] = $dimension_extreme['width_max'];
         $dimension_max['height'] = $dimension_extreme['height_max'];
     }
     /**
      * overwrite when fixed height requested
      */
     if ($height) {
         $dimension_max['height'] = $height;
     }
     /**
      * round
      */
     $dimension_max['width'] = round($dimension_max['width']);
     $dimension_max['height'] = round($dimension_max['height']);
     $this->tpl->assign("DIMENSION_MAX", $dimension_max);
     $this->tpl->assign("CYCLE", $cycle);
     /**
      * show control and placeholder only if multiple images
      */
     if ($images_count > 1) {
         $this->tpl->parse('content.control');
         $this->tpl->parse('content.placeholder');
     }
     return true;
 }
Exemple #6
0
 /**
  * getLargestAssociatedImageWidth
  */
 public function getLargestAssociatedImageWidth($node_id)
 {
     if (!is_numeric($node_id)) {
         return false;
     }
     require_once 'models/common/common_image.php';
     $Image = new common_image();
     /**
      * if not set, round to larges associated image with
      */
     $image_list = $Image->listFiles($this->node_data['id']);
     $image_width = 9999;
     foreach ($image_list as $item) {
         if ($item['imagesize']['width'] < $image_width) {
             $image_width = $item['imagesize']['width'] - $item['imagesize']['width'] % 5;
         }
     }
     if ($image_width == 9999) {
         $image_width = 800;
     }
     // default value
     return $image_width;
 }
Exemple #7
0
 /**
  * getTeaserImageForNodeId
  * If not available, try parent pages
  */
 public function getTeaserImageForNodeId($node_id, $role = 'teaser')
 {
     $node_detail = $this->detail($node_id);
     //don't need to call full nodeDetail
     switch ($node_detail['node_controller']) {
         case 'recipe':
             require_once 'models/ecommerce/ecommerce_recipe_image.php';
             $Image = new ecommerce_recipe_image();
             // change node ID
             $image_node_id = $node_detail['content'];
             break;
         case 'product':
             require_once 'models/ecommerce/ecommerce_product_image.php';
             $Image = new ecommerce_product_image();
             // change node ID
             $image_node_id = $node_detail['content'];
             break;
         case 'store':
             require_once 'models/ecommerce/ecommerce_store_image.php';
             $Image = new ecommerce_store_image();
             // change node ID
             $image_node_id = $node_detail['content'];
             break;
         case 'default':
         default:
             require_once 'models/common/common_image.php';
             $Image = new common_image();
             // node_id in common_node is direct reference to common_node.id
             $image_node_id = $node_id;
             break;
     }
     $image_detail = $Image->getTeaserImageForNodeId($image_node_id, $role);
     /* try parent recursively */
     if (!$image_detail && is_numeric($node_detail['parent'])) {
         $image_detail = $this->getTeaserImageForNodeId($node_detail['parent'], $role);
     }
     return $image_detail;
 }
Exemple #8
0
 /**
  * getOpenGraphImage
  */
 public function getOpenGraphImage($node_id, $content = false)
 {
     require_once 'models/common/common_image.php';
     $Image = new common_image();
     $image_list = $Image->listFiles($node_id, 'opengraph');
     if (is_array($image_list) && count($image_list) > 0) {
         return $image_list[0];
     } else {
         return false;
     }
 }
Exemple #9
0
 /**
  * Find where the file is used
  *
  * @param string $file
  * file src
  * 
  * @return array
  * file using places list
  */
 function getRelations($file)
 {
     require_once 'models/common/common_file.php';
     $CommonFile = new common_file();
     $file_list['file'] = $CommonFile->getFileLink($file);
     require_once 'models/common/common_image.php';
     $CommonImage = new common_image();
     $file_list['node'] = $CommonImage->getFileLink($file);
     require_once 'models/ecommerce/ecommerce_product_image.php';
     $ProductImage = new ecommerce_product_image();
     $file_list['product'] = $ProductImage->getFileLink($file);
     require_once 'models/ecommerce/ecommerce_product_variety_image.php';
     $ProductVarietyImage = new ecommerce_product_variety_image();
     $file_list['product_variety'] = $ProductVarietyImage->getFileLink($file);
     require_once 'models/common/common_taxonomy_label_image.php';
     $TaxonomyImage = new common_taxonomy_label_image();
     $file_list['taxonomy'] = $TaxonomyImage->getFileLink($file);
     require_once 'models/ecommerce/ecommerce_recipe_image.php';
     $RecipeImage = new ecommerce_recipe_image();
     $file_list['recipe'] = $RecipeImage->getFileLink($file);
     require_once 'models/ecommerce/ecommerce_store_image.php';
     $StoreImage = new ecommerce_store_image();
     $file_list['store'] = $StoreImage->getFileLink($file);
     require_once 'models/education/education_survey_image.php';
     $SurveyImage = new education_survey_image();
     $file_list['survey'] = $SurveyImage->getFileLink($file);
     $file_list['count'] = count($file_list['file']) + count($file_list['node']) + count($file_list['product']) + count($file_list['product_variety']) + count($file_list['taxonomy']) + count($file_list['recipe']) + count($file_list['store']) + count($file_list['survey']);
     return $file_list;
 }
Exemple #10
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * initialize
      */
     require_once 'models/common/common_node.php';
     require_once 'models/common/common_image.php';
     $Node = new common_node();
     $Image = new common_image();
     /**
      * find node id
      */
     if (is_numeric($this->GET['id'])) {
         $id = $this->GET['id'];
     } else {
         $id = $Node->conf['id_map-blog'];
     }
     /**
      * set header 
      */
     header('Content-Type: text/xml; charset=UTF-8');
     // flash in IE with SSL dont like Cache-Control: no-cache and Pragma: no-coche
     header("Cache-Control: ");
     header("Pragma: ");
     /**
      * Initialize pagination variables
      */
     if (is_numeric($this->GET['limit_from'])) {
         $from = $this->GET['limit_from'];
     } else {
         $from = 0;
     }
     if (is_numeric($this->GET['limit_per_page'])) {
         $per_page = $this->GET['limit_per_page'];
     } else {
         $per_page = 25;
     }
     $limit = "{$from},{$per_page}";
     /**
      * latest date
      */
     $rss_date = date('r', time());
     $this->tpl->assign("RSS_DATE", $rss_date);
     /**
      * check
      */
     if (!is_numeric($id)) {
         msg('export rss: id is not numeric', 'error');
         return false;
     }
     /**
      * process
      */
     $node_data = $Node->getDetail($id);
     $channel_taxonomy_labels = array();
     if ($node_data['publish'] == 1) {
         $this->tpl->assign('NODE', $node_data);
         $taxonomy_filter = '';
         if (is_numeric($this->GET['taxonomy_tree_id']) && $this->GET['taxonomy_tree_id'] > 0) {
             $taxonomy_filter = " AND id IN (SELECT node_id FROM common_node_taxonomy WHERE taxonomy_tree_id = {$this->GET['taxonomy_tree_id']})";
         }
         $children = $Node->listing("parent = {$id} AND publish = 1 AND node_group='page' {$taxonomy_filter}", "created DESC", $limit);
         foreach ($children as $c) {
             /**
              * create public link
              */
             $link = $Node->getSeoURL($c['id']);
             $c['url'] = "http://{$_SERVER['HTTP_HOST']}{$link}";
             /**
              * format date
              */
             $c['rss_date'] = date('r', strtotime($c['created']));
             /**
              * get categories
              */
             $taxonomy_list = $Node->getRelatedTaxonomy($c['id']);
             foreach ($taxonomy_list as $taxonomy) {
                 $this->tpl->assign('CATEGORY', $taxonomy);
                 $this->tpl->parse('content.item.category');
                 $channel_taxonomy_labels[$taxonomy['label']['title']] = true;
             }
             /**
              * add image (not part of RSS spec)
              */
             $c['image'] = $this->processImage($Image->getTeaserImageForNodeId($c['id']));
             /**
              * assign
              */
             $this->tpl->assign('CHILD', $c);
             if ($c['image']) {
                 $this->tpl->parse("content.item.image");
             }
             $this->tpl->parse("content.item");
         }
     }
     // parse channel category list
     $i = 0;
     foreach ($channel_taxonomy_labels as $label => $item) {
         if ($i + 1 < count($channel_taxonomy_labels)) {
             $label = $label . "/";
         }
         $this->tpl->assign('CATEGORY', $label);
         $this->tpl->parse('content.category');
         $i++;
     }
     return true;
 }
Exemple #11
0
 /**
  * main action
  */
 public function mainAction()
 {
     /* we need to include config*/
     require_once 'models/common/common_image.php';
     $common_image_conf = common_image::initConfiguration();
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $node_data = $Node->nodeDetail($this->GET['id']);
     if ($node_data['component']['template'] == '') {
         $node_data['component']['template'] = 'single';
     }
     /**
      * image size: set width
      */
     if (is_numeric($node_data['component']['main_image_width']) && $node_data['component']['main_image_width'] > 0) {
         $image_width = $node_data['component']['main_image_width'];
     } else {
         if ($node_data['component']['main_image_constrain']) {
             $Image = new common_image();
             $image_list = $Image->listFiles($node_data['id']);
             $image_width = 9999;
             foreach ($image_list as $item) {
                 if ($item['imagesize']['width'] < $image_width) {
                     $image_width = $item['imagesize']['width'] - $item['imagesize']['width'] % 5;
                 }
             }
             if ($image_width == 9999) {
                 $image_width = 0;
             }
         } else {
             $image_width = 0;
         }
     }
     /**
      * image size: check constrain and set appropriate height
      */
     switch ($node_data['component']['main_image_constrain']) {
         case '1-1':
             $image_height = $image_width;
             break;
         case '2_39-1':
             // 2.39:1
             $image_height = (int) ($image_width / 2.39 * 1);
             break;
         case '16-9':
             $image_height = (int) ($image_width / 16 * 9);
             break;
         case '4-3':
             $image_height = (int) ($image_width / 16 * 9);
             break;
         case '0':
         default:
             $image_height = 0;
             break;
     }
     /**
      * image size: fill cropping option
      * 
      */
     if (is_numeric($node_data['component']['image_fill'])) {
         $fill = $node_data['component']['image_fill'];
     } else {
         $fill = 1;
     }
     /**
      * what controller
      */
     if (file_exists(ONXSHOP_PROJECT_DIR . "controllers/component/image_gallery/{$node_data['component']['template']}.php") || file_exists(ONXSHOP_DIR . "controllers/component/image_gallery/{$node_data['component']['template']}.php")) {
         $image_controller = 'component/image_gallery/' . $node_data['component']['template'];
     } else {
         $image_controller = 'component/image_gallery';
     }
     /**
      * what template
      */
     if (file_exists(ONXSHOP_PROJECT_DIR . "templates/component/image_gallery/{$node_data['component']['template']}.html") || file_exists(ONXSHOP_DIR . "templates/component/image_gallery/{$node_data['component']['template']}.html")) {
         $image_template = 'component/image_gallery/' . $node_data['component']['template'];
     } else {
         $image_template = 'component/image_gallery';
     }
     /**
      * check cycle link_to_node_id
      */
     if ($node_data['component']['cycle']['link_to_node_id']) {
         $cycle['link_to_node_id'] = $node_data['component']['cycle']['link_to_node_id'];
     } else {
         $cycle['link_to_node_id'] = '';
     }
     /**
      * timeout for slideshow
      */
     if ($node_data['component']['cycle']['fx']) {
         $cycle['fx'] = $node_data['component']['cycle']['fx'];
     } else {
         $cycle['fx'] = $common_image_conf['cycle_fx'];
     }
     if ($node_data['component']['cycle']['easing']) {
         $cycle['easing'] = $node_data['component']['cycle']['easing'];
     } else {
         $cycle['easing'] = $common_image_conf['cycle_easing'];
     }
     if (is_numeric($node_data['component']['cycle']['speed'])) {
         $cycle['speed'] = $node_data['component']['cycle']['speed'];
     } else {
         $cycle['speed'] = $common_image_conf['cycle_speed'];
     }
     if (is_numeric($node_data['component']['cycle']['timeout'])) {
         $cycle['timeout'] = $node_data['component']['cycle']['timeout'];
     } else {
         $cycle['timeout'] = $common_image_conf['cycle_timeout'];
     }
     /**
      * disable limit
      */
     $image_limit = '';
     /**
      * call controller
      */
     $Onxshop_Request = new Onxshop_Request("{$image_controller}@{$image_template}~relation=node:role=main:width={$image_width}:height={$image_height}:fill={$fill}:node_id={$node_data['id']}:limit={$image_limit}:cycle_fx={$cycle['fx']}:cycle_easing={$cycle['easing']}:cycle_timeout={$cycle['timeout']}:cycle_speed={$cycle['speed']}:cycle_link_to_node_id={$cycle['link_to_node_id']}~");
     $this->tpl->assign("CONTENT", $Onxshop_Request->getContent());
     $this->tpl->assign('NODE', $node_data);
     $this->tpl->assign('IMAGE_CONF', $common_image_conf);
     /**
      * display title
      */
     $this->displayTitle($node_data);
     return true;
 }
            //if image, process it
        } else {
            if ($mime_type == 'application/pdf') {
                $image_file = "public_html/share/images/mimetype/pdf.png";
            } else {
                if ($mime_type == 'application/msword') {
                    $image_file = "public_html/share/images/mimetype/document.png";
                } else {
                    if ($mime_type == 'application/vnd.ms-excel') {
                        $image_file = "public_html/share/images/mimetype/spreadsheet.png";
                    } else {
                        $image_file = "public_html/share/images/mimetype/ascii.png";
                    }
                }
            }
        }
        /**
         * try
         */
        if ($thumbnail = common_image::resize($image_file, $width, $height, $method, $gravity, $fill)) {
            $image_file = $thumbnail;
        }
    } else {
        $image_file = null;
    }
}
/**
 * send image to the client through our image get script
 */
$_GET['image'] = $image_file;
include "image_get.php";
Exemple #13
0
 /**
  * insert node
  */
 public function insertImage($data)
 {
     $Image = new common_image();
     //print_r($data);
     //return 1;
     /** 
      * insert
      */
     if ($id = $Image->insert($data)) {
         return $id;
     } else {
         msg("Cannot insert image " . print_r($data, true), 'error');
         return false;
     }
 }