Sackgesicht VIP
Total posts: 1,626
15 Jul 2017 04:56

Is there an API call for thumbnails? Something which will check of the thumbnail is already generated and if not generate it, maybe return the URL of the generated thumbnail...

Last Modified: 21 Sep 2023


Sergey
Total posts: 13,688
26 Jul 2017 03:54

Yes. There is. Look at components/com_cobalt/fields/image/tmpl/output/list.php

$url = CImgHelper::getThumb(
    JPATH_ROOT . DIRECTORY_SEPARATOR . $image->get('image'), // Path to original image
    $this->params->get('params.thumbs_list_width', 100), // Max width in px
    $this->params->get('params.thumbs_list_height', 100), // Max height in px
    'image', // Subfolder for cobalt_thumbs folder
    $record->user_id, // ID of the use owns imade. optional. Use 0
    // Options how to generate thumbnail
    array(
        'mode' => $this->params->get('params.thumbs_list_mode', 1), // Mode how to generate. You can snick pick modes in parameters of the field 
        'strache' => $this->params->get('params.thumbs_list_stretch', 0), // Stratch image into new dimentions
        'background' => $this->params->get('params.thumbs_list_bg', "#000000"), // Background color
        'quality' => $this->params->get('params.thumbs_list_quality', 80))); // Quality in % 0-100
Powered by Cobalt