Example #1
0
 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param	array		Named array
  * @return	null|string	null is operation was satisfactory, otherwise returns an error
  * @see		JTable:bind
  * @since	3.4.0
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['new_icon'])) {
         // Get media path
         $params_media = JComponentHelper::getParams('com_media');
         $image_path = $params_media->get('image_path', 'images');
         // Paths to feature icons folder
         $thumbsPath = $image_path . '/icagenda/feature_icons';
         // Get Image File Infos
         $link_image = $array['new_icon'];
         $decomposition = explode('/', $link_image);
         // in each parent
         $i = 0;
         while (isset($decomposition[$i])) {
             $i++;
         }
         $i--;
         $imgname = $decomposition[$i];
         $fichier = explode('.', $decomposition[$i]);
         $imgtitle = $fichier[0];
         $imgextension = strtolower($fichier[1]);
         // Check file type if authorized to be generated as feature icon
         $authorized_types = array('jpg', 'jpeg', 'png', 'gif');
         if (!in_array($imgextension, $authorized_types) && $imgextension) {
             $this->setError('<strong>' . JText::_('COM_ICAGENDA_NOT_AUTHORIZED_IMAGE_TYPE') . '</strong><br />' . JText::_('COM_ICAGENDA_FORM_FEATURE_MIMETYPE_ERROR'));
             return false;
         } elseif ($imgextension) {
             // Clean icon name
             jimport('joomla.filter.output');
             $icon_name = JFilterOutput::stringURLSafe($imgtitle) . '.' . $imgextension;
             // Generate 16_bit if not exist
             iCThumbGet::thumbnail($array['new_icon'], $thumbsPath, '16_bit', '16', '16', '100', false, '', '', '', $icon_name);
             // Generate 24_bit if not exist
             iCThumbGet::thumbnail($array['new_icon'], $thumbsPath, '24_bit', '24', '24', '100', false, '', '', '', $icon_name);
             // Generate 32_bit if not exist
             iCThumbGet::thumbnail($array['new_icon'], $thumbsPath, '32_bit', '32', '32', '100', false, '', '', '', $icon_name);
             // Generate 48_bit if not exist
             iCThumbGet::thumbnail($array['new_icon'], $thumbsPath, '48_bit', '48', '48', '100', false, '', '', '', $icon_name);
             // Generate 64_bit if not exist
             iCThumbGet::thumbnail($array['new_icon'], $thumbsPath, '64_bit', '64', '64', '100', false, '', '', '', $icon_name);
             $array['icon'] = $icon_name;
         }
     }
     return parent::bind($array, $ignore);
 }
Example #2
0
        $xs_width = is_numeric($xs_thumbOptions[0]) ? $xs_thumbOptions[0] : '48';
        $xs_height = is_numeric($xs_thumbOptions[1]) ? $xs_thumbOptions[1] : '48';
        $xs_quality = is_numeric($xs_thumbOptions[2]) ? $xs_thumbOptions[2] : '80';
        $xs_crop = !empty($xs_thumbOptions[3]) ? true : false;
        // Generate large thumb if not exist
        iCThumbGet::thumbnail($item->image, $thumbsPath, 'themes', $l_width, $l_height, $l_quality, $l_crop, 'ic_large', null, true);
        // Generate medium thumb if not exist
        iCThumbGet::thumbnail($item->image, $thumbsPath, 'themes', $m_width, $m_height, $m_quality, $m_crop, 'ic_medium');
        // Generate small thumb if not exist
        iCThumbGet::thumbnail($item->image, $thumbsPath, 'themes', $s_width, $s_height, $s_quality, $s_crop, 'ic_small');
        // Generate x-small thumb if not exist
        iCThumbGet::thumbnail($item->image, $thumbsPath, 'themes', $xs_width, $xs_height, $xs_quality, $xs_crop, 'ic_xsmall');
        // Sub-folder Destination ($thumbsPath / 'subfolder' /)
        $subFolder = 'system';
        // Display thumbnail in admin events list
        echo iCThumbGet::thumbnailImgTagLinkModal($item->image, $thumbsPath, $subFolder, '120', '100', '100', false);
    } elseif ($item->image && $thumb_generator == 0) {
        if (filter_var($item->image, FILTER_VALIDATE_URL)) {
            echo '<a href="' . $item->image . '" class="modal">';
            echo '<img src="' . $item->image . '" alt="" /></a>';
        } else {
            echo '<a href="../' . $item->image . '" class="modal">';
            echo '<img src="../' . $item->image . '" alt="" /></a>';
        }
    } else {
        echo '<img style="max-width:120px; max-height:100px;" src="../media/com_icagenda/images/nophoto.jpg" alt="" />';
    }
    // END iCthumb
    ?>
						</div>
					</td>
Example #3
0
 /**
  * Return the SMALL thumbnail from an image
  * Generated by iCagenda with Global Options settings
  *
  * @since       3.4.0
  */
 public static function sizeXSmall($image, $type = null, $checksize = null)
 {
     $thumbsPath = self::iCagendaImagesPath();
     // Options XSmall Size
     $thumbOptions = JComponentHelper::getParams('com_icagenda')->get('thumb_xsmall');
     $width = is_numeric($thumbOptions[0]) ? $thumbOptions[0] : '48';
     $height = is_numeric($thumbOptions[1]) ? $thumbOptions[1] : '48';
     $quality = is_numeric($thumbOptions[2]) ? $thumbOptions[2] : '80';
     $crop = !empty($thumbOptions[3]) ? true : false;
     // Generate xsmall thumb if not exist
     $sizeXSmall = iCThumbGet::thumbnail($image, $thumbsPath, 'themes', $width, $height, $quality, $crop, 'ic_xsmall', $type, $checksize);
     return $sizeXSmall;
 }
Example #4
0
 /**
  * Return the thumbnail from an image, embed inside html tags
  * Link on thumbnail opens original image in modal
  *
  * @since   1.0.0
  */
 public static function thumbnailImgTagLinkModal($image, $thumbsPath, $subFolder, $width, $height, $quality, $crop = null, $prefix = null)
 {
     $thumbnailImgTag = iCThumbGet::thumbnail($image, $thumbsPath, $subFolder, $width, $height, $quality, $crop, $prefix, 'imgTagLinkModal');
     return $thumbnailImgTag;
 }