| Current Path : /home/giteleslfp/www/administrator/components/com_templateck/interfaces/ |
| Current File : /home/giteleslfp/www/administrator/components/com_templateck/interfaces/ajaxautocreatethumbs.php |
<?php
/**
* @name Template Creator CK
* @package com_templateck
* @copyright Copyright (C) 2013. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr
*/
// No direct access to this file
defined('TCK_LOADED') or die('Restricted access');
$data = $this->input->get('data', '', 'raw');
$templatename = $this->input->get('templatename', '', 'string');
$data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data));
$path = TEMPLATECREATORCK_TEMPLATES_PATH . '/' . $templatename;
if (file_exists($path)) {
if (TEMPLATECREATORCK_PLATFORM == 'joomla') {
file_put_contents($path . '/template_preview.png', $data);
file_put_contents($path . '/template_thumbnail.png', $data);
// resize automatically the images to avoid them to be too big
TemplateckHelper::resizeImage($path . '/template_preview.png', 640, '', '', '');
TemplateckHelper::resizeImage($path . '/template_thumbnail.png', 320, '', '', '');
} else {
file_put_contents($path . '/screenshot.png', $data);
// resize automatically the images to avoid them to be too big
TemplateckHelper::resizeImage($path . '/screenshot.png', 640, '', '', '');
}
}