本文整理汇总了PHP中FabrikWorker::isImageExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikWorker::isImageExtension方法的具体用法?PHP FabrikWorker::isImageExtension怎么用?PHP FabrikWorker::isImageExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikWorker
的用法示例。
在下文中一共展示了FabrikWorker::isImageExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _processIndUpload
/**
* Process the upload (can be called via ajax from pluploader)
*
* @param array &$file File info
* @param string $myFileDir User selected upload folder
* @param int $repeatGroupCounter Repeat group counter
*
* @return string Location of uploaded file
*/
protected function _processIndUpload(&$file, $myFileDir = '', $repeatGroupCounter = 0)
{
$params = $this->getParams();
$storage = $this->getStorage();
$quality = (int) $params->get('image_quality', 100);
// $$$ hugh - check if we need to blow away the cached file-path, set in validation
$myFileName = $storage->cleanName($file['name'], $repeatGroupCounter);
if ($myFileName != $file['name']) {
$file['name'] = $myFileName;
unset($this->_filePaths[$repeatGroupCounter]);
}
$tmpFile = $file['tmp_name'];
$uploader = $this->getFormModel()->getUploader();
if ($params->get('ul_file_types') == '') {
$params->set('ul_file_types', implode(',', $this->_getAllowedExtension()));
}
$err = null;
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
if ($myFileName == '') {
return;
}
$filePath = $this->_getFilePath($repeatGroupCounter);
if (!FabrikUploader::canUpload($file, $err, $params)) {
$this->setError($file['name'] . ': ' . FText::_($err));
}
if ($storage->exists($filePath)) {
switch ($params->get('ul_file_increment', 0)) {
case 0:
break;
case 1:
$filePath = FabrikUploader::incrementFileName($filePath, $filePath, 1);
break;
case 2:
JLog::add('Ind upload Delete file: ' . $filePath . '; user = ' . $this->user->get('id'), JLog::WARNING, 'com_fabrik.element.fileupload');
$storage->delete($filePath);
break;
}
}
if (!$storage->upload($tmpFile, $filePath)) {
$uploader->moveError = true;
$this->setError(100, JText::sprintf('PLG_ELEMENT_FILEUPLOAD_UPLOAD_ERR', $tmpFile, $filePath));
return;
}
$filePath = $storage->getUploadedFilePath();
jimport('joomla.filesystem.path');
$storage->setPermissions($filePath);
if (FabrikWorker::isImageExtension($filePath)) {
$oImage = FabimageHelper::loadLib($params->get('image_library'));
$oImage->setStorage($storage);
if ($params->get('upload_use_wip', '0') == '1') {
if ($params->get('fileupload_storage_type', 'filesystemstorage') == 'filesystemstorage') {
$mapElementId = $params->get('fu_map_element');
if (!empty($mapElementId)) {
$coordinates = $oImage->getExifCoordinates($filePath);
if (!empty($coordinates)) {
$formModel = $this->getFormModel();
$mapElementModel = $formModel->getElement($mapElementId, true);
$mapParams = $mapElementModel->getParams();
$zoom = $mapParams->get('fb_gm_zoomlevel', '10');
$coordinates_str = '(' . $coordinates[0] . ',' . $coordinates[1] . '):' . $zoom;
$mapElementName = $mapElementModel->getFullName(true, false);
$formModel->updateFormData($mapElementName, $coordinates_str, true);
}
}
$oImage->rotateImageFromExif($filePath, '');
}
}
// Resize main image
$mainWidth = $params->get('fu_main_max_width', '');
$mainHeight = $params->get('fu_main_max_height', '');
if ($mainWidth != '' || $mainHeight != '') {
// $$$ rob ensure that both values are integers otherwise resize fails
if ($mainHeight == '') {
$mainHeight = (int) $mainWidth;
}
if ($mainWidth == '') {
$mainWidth = (int) $mainHeight;
}
$oImage->resize($mainWidth, $mainHeight, $filePath, $filePath, $quality);
}
}
// $$$ hugh - if it's a PDF, make sure option is set to attempt PDF thumb
$make_thumbnail = $params->get('make_thumbnail') == '1' ? true : false;
if (JFile::getExt($filePath) == 'pdf' && $params->get('fu_make_pdf_thumb', '0') == '0') {
$make_thumbnail = false;
}
// $$$ trob - oImage->rezise is only set if isImageExtension
if (!FabrikWorker::isImageExtension($filePath)) {
$make_thumbnail = false;
//.........这里部分代码省略.........
示例2: button_result
/**
* Build the HTML for the plug-in button
*
* @return string
*/
public function button_result()
{
if ($this->canUse()) {
$p = $this->onGetFilterKey_result();
$j3 = FabrikWorker::j3();
FabrikHelperHTML::addPath('plugins/fabrik_list/' . $p . '/images/', 'image', 'list');
$name = $this->_getButtonName();
$label = $this->buttonLabel();
$imageName = $this->getImageName();
$tmpl = $this->getModel()->getTmpl();
$properties = array();
$opts = array('forceImage' => false);
if (FabrikWorker::isImageExtension($imageName)) {
$opts['forceImage'] = true;
}
$img = FabrikHelperHTML::image($imageName, 'list', $tmpl, $properties, false, $opts);
$text = $this->buttonAction == 'dropdown' ? $label : '<span class="hidden">' . $label . '</span>';
if ($j3 && $this->buttonAction != 'dropdown') {
$layout = FabrikHelperHTML::getLayout('fabrik-button');
$layoutData = (object) array('tag' => 'a', 'attributes' => 'data-list="' . $this->context . '" title="' . $label . '"', 'class' => $name . ' listplugin btn-default', 'label' => $img . ' ' . $text);
return $layout->render($layoutData);
} else {
$a = '<a href="#" data-list="' . $this->context . '" class="' . $name . ' listplugin" title="' . $label . '">';
return $a . $img . ' ' . $text . '</a>';
}
}
return '';
}