/** * Delete image */ public function removeImage() { // Check for request forgeries. JSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN')); // Check for registered user $userId = JFactory::getUser()->get('id'); if (!$userId) { $redirectOptions = array('force_direction' => 'index.php?option=com_users&view=login'); $this->displayNotice(JText::_('COM_SOCIALCOMMUNITY_ERROR_NOT_LOG_IN'), $redirectOptions); return; } $redirectOptions = array('view' => 'form', 'layout' => 'avatar'); try { $params = JComponentHelper::getParams('com_socialcommunity'); $filesystemHelper = new Prism\Filesystem\Helper($params); jimport('Prism.libs.init'); $storageFilesystem = $filesystemHelper->getFilesystem(); $mediaFolder = $filesystemHelper->getMediaFolder($userId); $model = $this->getModel(); $model->removeImage($userId, $mediaFolder, $storageFilesystem); } catch (Exception $e) { JLog::add($e->getMessage()); throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM')); } $this->displayMessage(JText::_('COM_SOCIALCOMMUNITY_IMAGE_DELETED'), $redirectOptions); }
/** * Pre-processor for $table->delete($pk) * * @param mixed $pk An optional primary key value to delete. If not set the instance property value is used. * * @return void * * @since 3.1.2 * @throws UnexpectedValueException */ public function onAfterDelete($pk) { $params = JComponentHelper::getParams('com_gamification'); /** @var $params Joomla\Registry\Registry */ $filesystemHelper = new Prism\Filesystem\Helper($params); $mediaFolder = $filesystemHelper->getMediaFolder(); if ($this->table->get('image') !== null and $this->table->get('image') !== '') { $file = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $mediaFolder . DIRECTORY_SEPARATOR . $this->table->get('image')); if (JFile::exists($file)) { JFile::delete($file); } } if ($this->table->get('image_small') !== null and $this->table->get('image_small') !== '') { $file = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $mediaFolder . DIRECTORY_SEPARATOR . $this->table->get('image_small')); if (JFile::exists($file)) { JFile::delete($file); } } if ($this->table->get('image_square') !== null and $this->table->get('image_square') !== '') { $file = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $mediaFolder . DIRECTORY_SEPARATOR . $this->table->get('image_square')); if (JFile::exists($file)) { JFile::delete($file); } } }
public function display($tpl = null) { $this->option = JFactory::getApplication()->input->get('option'); $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); // Load the component parameters. $params = JComponentHelper::getParams($this->option); $filesystemHelper = new Prism\Filesystem\Helper($params); $this->mediaFolder = $filesystemHelper->getMediaFolder(); // Prepare actions, behaviors, scripts and document $this->addToolbar(); $this->setDocument(); parent::display($tpl); }
/** * Pre-processor for $table->delete($pk) * * @param mixed $pk An optional primary key value to delete. If not set the instance property value is used. * * @return void * * @since 3.1.2 * @throws UnexpectedValueException */ public function onBeforeDelete($pk) { $db = $this->table->getDbo(); jimport('Socialcommunity.profile'); $profile = new Socialcommunity\Profile\Profile($db); $profile->load($this->table->id); if ($profile->getId()) { $params = JComponentHelper::getParams('com_socialcommunity'); /** @var $params Joomla\Registry\Registry */ $filesystemHelper = new Prism\Filesystem\Helper($params); $mediaFolder = $filesystemHelper->getMediaFolderUri($profile->getId()); $filesystem = $filesystemHelper->getFilesystem(); $profile->removeImages($filesystem, $mediaFolder); } }
/** * This method store a post by user. */ public function storePost() { $app = JFactory::getApplication(); /** @var $app JApplicationSite */ $content = $this->input->getString('content'); $user = JFactory::getUser(); $userId = $user->get('id'); $content = JString::trim(strip_tags($content)); $content = JHtmlString::truncate($content, 140); if (!$userId) { $app->close(); } $userTimeZone = !$user->getParam('timezone') ? null : $user->getParam('timezone'); try { $date = new JDate('now', $userTimeZone); $entity = new Socialcommunity\Wall\User\Post(JFactory::getDbo()); $entity->setUserId($userId); $entity->setContent($content); $entity->setCreated($date->toSql(true)); $entity->store(); } catch (Exception $e) { JLog::add($e->getMessage()); throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM')); } $params = JComponentHelper::getParams('com_socialcommunity'); $filesystemHelper = new Prism\Filesystem\Helper($params); $mediaFolder = $filesystemHelper->getMediaFolderUri($userId); $profile = new Socialcommunity\Profile\Profile(JFactory::getDbo()); $profile->load(['user_id' => $userId]); $displayData = new stdClass(); $displayData->id = $entity->getId(); $displayData->profileLink = JRoute::_(SocialCommunityHelperRoute::getProfileRoute($profile->getSlug()), false); $displayData->name = htmlentities($profile->getName(), ENT_QUOTES, 'utf-8'); $displayData->alias = htmlentities($profile->getAlias(), ENT_QUOTES, 'utf-8'); $displayData->imageSquare = $mediaFolder . '/' . $profile->getImageSquare(); $displayData->imageAlt = $displayData->name; $displayData->content = $entity->getContent(); $displayData->created = JHtml::_('socialcommunity.created', $entity->getCreated(), $userTimeZone); $layout = new JLayoutFile('wall_post'); echo $layout->render($displayData); $app->close(); }
public function display($tpl = null) { $this->option = JFactory::getApplication()->input->get('option'); $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); // Load the component parameters. $params = JComponentHelper::getParams($this->option); $filesystemHelper = new Prism\Filesystem\Helper($params); $this->mediaFolder = $filesystemHelper->getMediaFolder(); // Prepare contexts. $achievements = new Gamification\Achievement\Achievements(JFactory::getDbo()); $contexts = $achievements->getContexts(); $js = 'var gfyContexts = ' . json_encode($contexts) . ';'; $this->document->addScriptDeclaration($js); // Prepare actions, behaviors, scripts and document $this->addToolbar(); $this->setDocument(); parent::display($tpl); }
public function display($tpl = null) { $this->option = JFactory::getApplication()->input->get('option'); $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); $this->params = $this->state->get('params'); if (!$this->item->id) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('COM_SOCIALCOMMUNITY_NO_PROFILE'), 'notice'); $app->redirect(JRoute::_('index.php?option=com_socialcommunity&view=profiles', false)); return; } $filesystemHelper = new Prism\Filesystem\Helper($this->params); $this->mediaFolder = $filesystemHelper->getMediaFolderUri($this->item->user_id); // Prepare actions, behaviors, scripts and document $this->addToolbar(); $this->setDocument(); parent::display($tpl); }
private function createProfile($userId, $name) { $data = array('user_id' => (int) $userId, 'name' => $name, 'alias' => $name, 'active' => Prism\Constants::ACTIVE); $profile = new Socialcommunity\Profile\Profile($this->db); $profile->bind($data); $profile->store(); $params = JComponentHelper::getParams('com_socialcommunity'); /** @var $params Joomla\Registry\Registry */ $filesystemHelper = new Prism\Filesystem\Helper($params); // If the filesystem is local, create a user folder. if ($filesystemHelper->isLocal()) { $mediaFolder = JPath::clean(JPATH_BASE . '/' . $filesystemHelper->getMediaFolder($userId), '/'); if (!JFolder::exists($mediaFolder)) { JFolder::create($mediaFolder); } } }
public function display($tpl = null) { $this->app = JFactory::getApplication(); $this->option = $this->app->input->get('option'); /** @var $model SocialCommunityModelProfile */ $model = $this->getModel(); $this->state = $model->getState(); $this->item = $model->getItem(); $this->params = $this->state->get('params'); $this->visitorId = $this->state->get($this->option . '.visitor.id'); $this->isOwner = $this->state->get($this->option . '.visitor.is_owner'); $this->targetId = $this->state->get($this->option . '.target.user_id'); // If I am not logged in, and I try to load profile page without user ID as a parameter, // I must load the layout of registration and login form. if (!$this->visitorId and !$this->item) { $this->setLayout('registration'); } // If there is target ID but there is no valid item, // go on the view "No Profile". The profile does not exists. if ($this->targetId and !$this->item) { $this->setLayout('noprofile'); } switch ($this->getLayout()) { case 'registration': $this->prepareRegistration(); break; case 'noprofile': $this->prepareNoProfile(); break; default: // default layout $filesystemHelper = new Prism\Filesystem\Helper($this->params); $this->mediaFolder = $filesystemHelper->getMediaFolderUri($this->item->user_id); // Display details layout if // - visitor is not registered and there is target ID. // - visitor is registered but he is not the owner of the profile. if (!$this->visitorId and $this->targetId or $this->visitorId and !$this->isOwner) { $this->setLayout('details'); // Details page. } else { $this->setLayout('default'); // Profile owner's wall. } // If the wall has been disabled, display profile details. if (!$this->params->get('profile_wall', Prism\Constants::ENABLED)) { $this->setLayout('details'); // Details page. } $pluginContext = 'com_socialcommunity.profile'; switch ($this->getLayout()) { case 'default': $pluginContext .= '.wall'; // If I am logged in and I try to load profile page, // but I do not provide valid profile ID, // I have to display error message. if (!$this->item and $this->visitor->id > 0) { $menu = $this->app->getMenu(); $menuItem = $menu->getDefault(); $this->app->enqueueMessage(JText::_('COM_SOCIALCOMMUNITY_ERROR_INVALID_PROFILE'), 'notice'); $this->app->redirect(JRoute::_('index.php?Itemid=' . $menuItem->id, false)); return; } $this->prepareWall(); break; default: // details $pluginContext .= '.details'; $this->prepareDetails(); break; } // Import content plugins JPluginHelper::importPlugin('content'); // Events $dispatcher = JEventDispatcher::getInstance(); $this->item->event = new stdClass(); $offset = 0; $results = $dispatcher->trigger('onContentBeforeDisplay', array($pluginContext, &$this->item, &$this->params, $offset)); $this->item->event->beforeDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentBeforeDisplayProfile', array($pluginContext, &$this->item, &$this->params)); $this->item->event->beforeDisplayProfileContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentAfterDisplayProfile', array($pluginContext, &$this->item, &$this->params)); $this->item->event->afterDisplayProfileContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentAfterDisplay', array($pluginContext, &$this->item, &$this->params, $offset)); $this->item->event->afterDisplayContent = trim(implode("\n", $results)); break; } $this->prepareDocument(); parent::display($tpl); }
/** * Store the file in a folder of the extension. * * @param array $image * @param bool $resizeImage * * @throws \RuntimeException * @throws \Exception * @throws \InvalidArgumentException * * @return array */ public function uploadImage($image, $resizeImage = false) { $app = JFactory::getApplication(); /** @var $app JApplicationSite */ $uploadedFile = ArrayHelper::getValue($image, 'tmp_name'); $uploadedName = ArrayHelper::getValue($image, 'name'); $errorCode = ArrayHelper::getValue($image, 'error'); $params = JComponentHelper::getParams($this->option); /** @var $params Joomla\Registry\Registry */ $filesystemHelper = new Prism\Filesystem\Helper($params); $mediaFolder = $filesystemHelper->getMediaFolder(); $destinationFolder = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $mediaFolder); $temporaryFolder = $app->get('tmp_path'); // Joomla! media extension parameters $mediaParams = JComponentHelper::getParams('com_media'); /** @var $mediaParams Joomla\Registry\Registry */ $file = new Prism\File\File(); // Prepare size validator. $KB = 1024 * 1024; $fileSize = (int) $app->input->server->get('CONTENT_LENGTH'); $uploadMaxSize = $mediaParams->get('upload_maxsize') * $KB; // Prepare file validators. $sizeValidator = new Prism\File\Validator\Size($fileSize, $uploadMaxSize); $serverValidator = new Prism\File\Validator\Server($errorCode, array(UPLOAD_ERR_NO_FILE)); $imageValidator = new Prism\File\Validator\Image($uploadedFile, $uploadedName); // Get allowed mime types from media manager options $mimeTypes = explode(',', $mediaParams->get('upload_mime')); $imageValidator->setMimeTypes($mimeTypes); // Get allowed image extensions from media manager options $imageExtensions = explode(',', $mediaParams->get('image_extensions')); $imageValidator->setImageExtensions($imageExtensions); $file->addValidator($sizeValidator)->addValidator($serverValidator)->addValidator($imageValidator); // Validate the file if (!$file->isValid()) { throw new RuntimeException($file->getError()); } // Generate temporary file name $ext = strtolower(JFile::makeSafe(JFile::getExt($image['name']))); $generatedName = Prism\Utilities\StringHelper::generateRandomString(); $temporaryFile = $generatedName . '_reward.' . $ext; $temporaryDestination = JPath::clean($temporaryFolder . DIRECTORY_SEPARATOR . $temporaryFile); // Prepare uploader object. $uploader = new Prism\File\Uploader\Local($uploadedFile); $uploader->setDestination($temporaryDestination); // Upload temporary file $file->setUploader($uploader); $file->upload(); $temporaryFile = $file->getFile(); if (!is_file($temporaryFile)) { throw new Exception('COM_GAMIFICATION_ERROR_FILE_CANT_BE_UPLOADED'); } // Resize image $image = new JImage(); $image->loadFile($temporaryFile); if (!$image->isLoaded()) { throw new Exception(JText::sprintf('COM_GAMIFICATION_ERROR_FILE_NOT_FOUND', $temporaryDestination)); } $imageName = $generatedName . '_image.png'; $smallName = $generatedName . '_small.png'; $squareName = $generatedName . '_square.png'; $imageFile = $destinationFolder . DIRECTORY_SEPARATOR . $imageName; $smallFile = $destinationFolder . DIRECTORY_SEPARATOR . $smallName; $squareFile = $destinationFolder . DIRECTORY_SEPARATOR . $squareName; $scaleOption = $params->get('image_resizing_scale', JImage::SCALE_INSIDE); // Create main image if (!$resizeImage) { $image->toFile($imageFile, IMAGETYPE_PNG); } else { $width = $params->get('image_width', 200); $height = $params->get('image_height', 200); $image->resize($width, $height, false, $scaleOption); $image->toFile($imageFile, IMAGETYPE_PNG); } // Create small image $width = $params->get('image_small_width', 100); $height = $params->get('image_small_height', 100); $image->resize($width, $height, false, $scaleOption); $image->toFile($smallFile, IMAGETYPE_PNG); // Create square image $width = $params->get('image_square_width', 50); $height = $params->get('image_square_height', 50); $image->resize($width, $height, false, $scaleOption); $image->toFile($squareFile, IMAGETYPE_PNG); $names = array('image' => $imageName, 'image_small' => $smallName, 'image_square' => $squareName); // Remove the temporary file. if (JFile::exists($temporaryFile)) { JFile::delete($temporaryFile); } return $names; }
/** * Store the file in a folder of the extension. * * @param array $image * * @throws \InvalidArgumentException * @throws \Exception * @throws \UnexpectedValueException * @throws \RuntimeException * * @return string */ public function uploadImage($image) { $app = JFactory::getApplication(); /** @var $app JApplicationSite */ $uploadedFile = ArrayHelper::getValue($image, 'tmp_name'); $uploadedName = ArrayHelper::getValue($image, 'name'); $errorCode = ArrayHelper::getValue($image, 'error'); $params = JComponentHelper::getParams($this->option); /** @var $params Joomla\Registry\Registry */ $filesystemHelper = new Prism\Filesystem\Helper($params); $mediaFolder = $filesystemHelper->getMediaFolder(); $destinationFolder = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $mediaFolder); // Joomla! media extension parameters $mediaParams = JComponentHelper::getParams('com_media'); /** @var $mediaParams Joomla\Registry\Registry */ $file = new Prism\File\File(); // Prepare size validator. $KB = 1024 * 1024; $fileSize = (int) $app->input->server->get('CONTENT_LENGTH'); $uploadMaxSize = $mediaParams->get('upload_maxsize') * $KB; // Prepare file validators. $sizeValidator = new Prism\File\Validator\Size($fileSize, $uploadMaxSize); $serverValidator = new Prism\File\Validator\Server($errorCode, array(UPLOAD_ERR_NO_FILE)); $imageValidator = new Prism\File\Validator\Image($uploadedFile, $uploadedName); // Get allowed mime types from media manager options $mimeTypes = explode(',', $mediaParams->get('upload_mime')); $imageValidator->setMimeTypes($mimeTypes); // Get allowed image extensions from media manager options $imageExtensions = explode(',', $mediaParams->get('image_extensions')); $imageValidator->setImageExtensions($imageExtensions); $file->addValidator($sizeValidator)->addValidator($serverValidator)->addValidator($imageValidator); // Validate the file if (!$file->isValid()) { throw new RuntimeException($file->getError()); } // Generate temporary file name $ext = strtolower(JFile::makeSafe(JFile::getExt($image['name']))); $generatedName = Prism\Utilities\StringHelper::generateRandomString(16); $imageName = $generatedName . '_badge.' . $ext; $destination = JPath::clean($destinationFolder . DIRECTORY_SEPARATOR . $imageName); // Prepare uploader object. $uploader = new Prism\File\Uploader\Local($uploadedFile); $uploader->setDestination($destination); // Upload temporary file $file->setUploader($uploader); $file->upload(); $source = $file->getFile(); return basename($source); }
public function cropImage() { // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); /** @var $app JApplicationSite */ $response = new Prism\Response\Json(); $userId = JFactory::getUser()->get('id'); if (!$userId) { $response->setTitle(JText::_('COM_SOCIALCOMMUNITY_FAILURE'))->setText(JText::_('COM_SOCIALCOMMUNITY_ERROR_NOT_LOG_IN'))->failure(); echo $response; $app->close(); } // Get the model $model = $this->getModel(); /** @var $model SocialcommunityModelAvatar */ $params = JComponentHelper::getParams('com_socialcommunity'); $filesystemHelper = new Prism\Filesystem\Helper($params); // Get the filename from the session. $fileName = basename($app->getUserState(Socialcommunity\Constants::TEMPORARY_IMAGE_CONTEXT)); $temporaryFolder = $filesystemHelper->getTemporaryMediaFolder(JPATH_BASE); $temporaryFile = JPath::clean($temporaryFolder . '/' . $fileName); if (!$fileName or !JFile::exists($temporaryFile)) { $response->setTitle(JText::_('COM_SOCIALCOMMUNITY_FAILURE'))->setText(JText::_('COM_SOCIALCOMMUNITY_ERROR_FILE_DOES_NOT_EXIST'))->failure(); echo $response; $app->close(); } $imageUrl = ''; try { // Get the folder where the images will be stored $params = JComponentHelper::getParams('com_socialcommunity'); $options = array('width' => $this->input->getFloat('width'), 'height' => $this->input->getFloat('height'), 'x' => $this->input->getFloat('x'), 'y' => $this->input->getFloat('y'), 'destination' => $temporaryFolder); // Resize the picture. $images = $model->cropImage($temporaryFile, $options, $params); jimport('Prism.libs.init'); $temporaryAdapter = new League\Flysystem\Adapter\Local($temporaryFolder); $temporaryFilesystem = new League\Flysystem\Filesystem($temporaryAdapter); $storageFilesystem = $filesystemHelper->getFilesystem(); $manager = new League\Flysystem\MountManager(['temporary' => $temporaryFilesystem, 'storage' => $storageFilesystem]); $mediaFolder = $filesystemHelper->getMediaFolder($userId); $model->moveImages($images, $mediaFolder, $manager); $model->storeImages($userId, $images, $mediaFolder, $storageFilesystem); // Prepare URL to the image. $imageName = basename(Joomla\Utilities\ArrayHelper::getValue($images, 'image_profile')); $imageUrl = $filesystemHelper->getMediaFolderUri($userId) . '/' . $imageName; $app->setUserState(Socialcommunity\Constants::TEMPORARY_IMAGE_CONTEXT, null); } catch (RuntimeException $e) { $response->setTitle(JText::_('COM_SOCIALCOMMUNITY_FAILURE'))->setText($e->getMessage())->failure(); echo $response; $app->close(); } catch (Exception $e) { JLog::add($e->getMessage(), JLog::DEBUG); $response->setTitle(JText::_('COM_SOCIALCOMMUNITY_FAILURE'))->setText(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM'))->failure(); echo $response; $app->close(); } $response->setTitle(JText::_('COM_SOCIALCOMMUNITY_SUCCESS'))->setText(JText::_('COM_SOCIALCOMMUNITY_IMAGE_SAVED'))->setData($imageUrl)->success(); echo $response; $app->close(); }
protected function prepareAvatar() { $model = JModelLegacy::getInstance('Avatar', 'SocialCommunityModel', $config = array('ignore_request' => false)); $this->state = $model->getState(); $this->params = $this->state->get('params'); $filesystemHelper = new Prism\Filesystem\Helper($this->params); $this->mediaFolder = $filesystemHelper->getMediaFolderUri($this->userId); $this->item = $model->getItem($this->userId); $file = basename($this->app->getUserState(Socialcommunity\Constants::TEMPORARY_IMAGE_CONTEXT)); $this->fileForCropping = !$file ? null : JUri::base() . $filesystemHelper->getTemporaryMediaFolderUri() . '/' . $file; $this->displayRemoveButton = 'none'; $js = ' var socialCommunityOptions = {'; if (!$this->params->get('image_aspect_ratio', '')) { $js .= ' aspectRatio: ""'; } else { $js .= ' aspectRatio: ' . $this->params->get('image_aspect_ratio', ''); } $js .= ' }'; $this->document->addScriptDeclaration($js); }
/** * Delete image */ public function removeImage() { // Check for request forgeries. JSession::checkToken('get') or jexit(JText::_('JINVALID_TOKEN')); $itemId = $this->input->getInt('id', 0); $profile = new Socialcommunity\Profile\Profile(JFactory::getDbo()); $profile->load($itemId); $redirectOptions = array('view' => 'profile', 'id' => $itemId); if (!$profile->getId()) { $this->displayNotice(JText::_('COM_SOCIALCOMMUNITY_INVALID_PROFILE'), $redirectOptions); return; } try { $params = JComponentHelper::getParams('com_socialcommunity'); $filesystemHelper = new Prism\Filesystem\Helper($params); jimport('Prism.libs.init'); $storageFilesystem = $filesystemHelper->getFilesystem(); $mediaFolder = $filesystemHelper->getMediaFolder($profile->getUserId()); $model = $this->getModel(); $model->removeImage($itemId, $mediaFolder, $storageFilesystem); } catch (Exception $e) { JLog::add($e->getMessage()); throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM')); } $this->displayMessage(JText::_('COM_SOCIALCOMMUNITY_IMAGE_DELETED'), $redirectOptions); }
/** * Prepare and sanitise the table prior to saving. * * @param SocialCommunityTableProfile $table * @param array $data * * @since 1.6 */ protected function prepareImages($table, $data) { // Prepare image if (!empty($data['image'])) { $params = JComponentHelper::getParams($this->option); /** @var $params Joomla\Registry\Registry */ jimport('Prism.libs.init'); $filesystemHelper = new Prism\Filesystem\Helper($params); $mediaFolder = $filesystemHelper->getMediaFolder($data['user_id']); $storageFilesystem = $filesystemHelper->getFilesystem(); // Delete old image if I upload a new one if ($table->get('image')) { $this->deleteImages($table, $mediaFolder, $storageFilesystem); } // Move the images from temporary to media folder. $this->moveImages($data, $mediaFolder, $storageFilesystem); $table->set('image', $data['image']); $table->set('image_small', $data['image_small']); $table->set('image_icon', $data['image_icon']); $table->set('image_square', $data['image_square']); } }