本文整理汇总了PHP中vignette函数的典型用法代码示例。如果您正苦于以下问题:PHP vignette函数的具体用法?PHP vignette怎么用?PHP vignette使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vignette函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dol_move_uploaded_file
$newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
$result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1);
if (! $result > 0)
{
$errors[] = "ErrorFailedToSaveFile";
}
else
{
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
}
}
}
}
// We set country_id, country_code and country for the selected country
$object->country_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
if ($object->country_id)
{
$tmparray=getCountry($object->country_id,'all');
$object->country_code=$tmparray['code'];
$object->country=$tmparray['label'];
}
$object->forme_juridique_code=$_POST['forme_juridique_code'];
/* Show create form */
示例2: dol_move_uploaded_file
* Actions
*/
// Envoi fichier
if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($object->fetch($id)) {
$upload_dir = $conf->bank->dir_output . "/" . $object->ref;
if (dol_mkdir($upload_dir) >= 0) {
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 0, 0, $_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0) {
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) {
// Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
// Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
}
$mesg = '<div class="ok">' . $langs->trans("FileTransferComplete") . '</div>';
} else {
$langs->load("errors");
if ($resupload < 0) {
// Unknown error
$mesg = '<div class="error">' . $langs->trans("ErrorFileNotUploaded") . '</div>';
} else {
if (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) {
// Files infected by a virus
$mesg = '<div class="error">' . $langs->trans("ErrorFileIsInfectedWithAVirus") . '</div>';
} else {
// Known error
$mesg = '<div class="error">' . $langs->trans($resupload) . '</div>';
}
示例3: add_thumb
/**
* Build thumb
*
* @param string $file Chemin du fichier d'origine
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
* @return void
*/
function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
{
require_once(DOL_DOCUMENT_ROOT ."/core/lib/images.lib.php");
$file_osencoded=dol_osencode($file);
if (file_exists($file_osencoded))
{
vignette($file,$maxWidth,$maxHeight);
}
}
示例4: getImageProduct
/**
* Return path of a catergory image
*
* @param int $idCat Id of Category
* @return string Image path
*/
public static function getImageProduct($idProd, $thumb = false)
{
global $conf, $db;
$extName = "_small";
$extImgTarget = ".jpg";
$outDir = "pos";
$maxWidth = 90;
$maxHeight = 90;
$quality = 50;
if ($idProd > 0) {
$objProd = new Product($db);
$objProd->fetch($idProd);
$pdir = get_exdir($idProd, 2) . $idProd . "/photos/";
$dir = $conf->product->multidir_output[$objProd->entity] . '/' . $pdir;
foreach ($objProd->liste_photos($dir, 1) as $key => $obj) {
$filename = $dir . $obj['photo'];
$filethumbs = $dir . $outDir . '/' . $obj['photo'];
$fileName = preg_replace('/(\\.gif|\\.jpeg|\\.jpg|\\.png|\\.bmp)$/i', '', $filethumbs);
$fileName = basename($fileName);
$imgThumbName = $dir . $outDir . '/' . $fileName . $extName . $extImgTarget;
$file_osencoded = $imgThumbName;
if (!file_exists($file_osencoded)) {
$file_osencoded = dol_osencode($filename);
if (file_exists($file_osencoded)) {
require_once DOL_DOCUMENT_ROOT . "/core/lib/images.lib.php";
vignette($filename, $maxWidth, $maxHeight, $extName, $quality, $outDir, 2);
}
}
if (!$thumb) {
$filename = $obj['photo'];
} else {
$filename = $outDir . '/' . $fileName . $extName . $extImgTarget;
}
$realpath = DOL_URL_ROOT . '/viewimage.php?modulepart=product&entity=' . $objProd->entity . '&file=' . urlencode($pdir . $filename);
}
if (!$realpath) {
$realpath = DOL_URL_ROOT . '/viewimage.php?modulepart=product&file=' . urlencode('noimage.jpg');
}
return $realpath;
}
}
示例5: createScaledImage
/**
* Create thumbs
*
* @param string $file_name Filename
* @param string $options is array('max_width', 'max_height')
* @return void
*/
protected function createScaledImage($file_name, $options)
{
global $maxwidthmini, $maxheightmini;
$file_path = $this->options['upload_dir'] . $file_name;
$new_file_path = $options['upload_dir'] . $file_name;
if (dol_mkdir($options['upload_dir']) >= 0) {
list($img_width, $img_height) = @getimagesize($file_path);
if (!$img_width || !$img_height) {
return false;
}
$res = vignette($file_path, $maxwidthmini, $maxheightmini, '_mini');
//return $success;
if (preg_match('/error/i', $res)) {
return false;
}
return true;
} else {
return false;
}
}
示例6: add_thumb
/**
* Build thumb
*
* @param string $file Chemin du fichier d'origine
* @return void
*/
function add_thumb($file)
{
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
// This define also $maxwidthsmall, $quality, ...
$file_osencoded = dol_osencode($file);
if (file_exists($file_osencoded)) {
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($file, $maxwidthmini, $maxheightmini, '_mini', $quality);
}
}
示例7: add_thumb
/**
* \brief Build thumb
* \param sdir Repertoire destination finale
* \param file Chemin du fichier d'origine
* \param maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
* \param maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
*/
function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
{
require_once DOL_DOCUMENT_ROOT . "/lib/images.lib.php";
if (file_exists($file)) {
vignette($file, $maxWidth, $maxHeight);
}
}
示例8: dol_add_file_process
/**
* Get and save an upload file (for example after submitting a new file a mail form).
* All information used are in db, conf, langs, user and _FILES.
* Note: This function can be used only into a HTML page context.
*
* @param string $upload_dir Directory where to store uploaded file (note: also find in first part of dest_file)
* @param int $allowoverwrite 1=Allow overwrite existing file
* @param int $donotupdatesession 1=Do no edit _SESSION variable
* @param string $varfiles _FILES var name
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param string $link Link to add
* @return void
*/
function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesession = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null)
{
global $db, $user, $conf, $langs;
if (!empty($_FILES[$varfiles])) {
dol_syslog('dol_add_file_process upload_dir=' . $upload_dir . ' allowoverwrite=' . $allowoverwrite . ' donotupdatesession=' . $donotupdatesession . ' savingdocmask=' . $savingdocmask, LOG_DEBUG);
if (dol_mkdir($upload_dir) >= 0) {
$TFile = $_FILES[$varfiles];
if (!is_array($TFile['name'])) {
foreach ($TFile as $key => &$val) {
$val = array($val);
}
}
$nbfile = count($TFile['name']);
for ($i = 0; $i < $nbfile; $i++) {
// Define $destpath (path to file including filename) and $destfile (only filename)
$destpath = $upload_dir . "/" . $TFile['name'][$i];
$destfile = $TFile['name'][$i];
$savingdocmask = dol_sanitizeFileName($savingdocmask);
if ($savingdocmask) {
$destpath = $upload_dir . "/" . preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask);
$destfile = preg_replace('/__file__/', $TFile['name'][$i], $savingdocmask);
}
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destpath, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
if (is_numeric($resupload) && $resupload > 0) {
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini;
include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
if (empty($donotupdatesession)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->add_attached_files($destpath, $destfile, $TFile['type'][$i]);
}
if (image_format_supported($destpath) == 1) {
// Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs");
// Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
}
setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
} else {
$langs->load("errors");
if ($resupload < 0) {
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
} else {
if (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) {
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
} else {
setEventMessages($langs->trans($resupload), null, 'errors');
}
}
}
}
}
} elseif ($link) {
if (dol_mkdir($upload_dir) >= 0) {
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$linkObject = new Link($db);
$linkObject->entity = $conf->entity;
$linkObject->url = $link;
$linkObject->objecttype = GETPOST('objecttype', 'alpha');
$linkObject->objectid = GETPOST('objectid', 'int');
$linkObject->label = GETPOST('label', 'alpha');
$res = $linkObject->create($user);
$langs->load('link');
if ($res > 0) {
setEventMessages($langs->trans("LinkComplete"), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFileNotLinked"), null, 'errors');
}
}
} else {
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("File")), null, 'errors');
}
}
示例9: image_format_supported
if (file_exists($conf->mycompany->dir_output . '/logos/' . $_GET["file"])) {
$isimage = image_format_supported($_GET["file"]);
// Create thumbs of logo
if ($isimage > 0) {
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($conf->mycompany->dir_output . '/logos/' . $_GET["file"], $maxwidthsmall, $maxheightsmall, '_small', $quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) {
$imgThumbSmall = $reg[1];
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
} else {
dol_syslog($imgThumbSmall);
}
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($conf->mycompany->dir_output . '/logos/' . $_GET["file"], $maxwidthmini, $maxheightmini, '_mini', $quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbMini, $reg)) {
$imgThumbMini = $reg[1];
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
} else {
dol_syslog($imgThumbMini);
}
Header("Location: " . $_SERVER["PHP_SELF"]);
exit;
} else {
$message .= '<div class="error">' . $langs->trans("ErrorImageFormatNotSupported") . '</div>';
dol_syslog($langs->transnoentities("ErrorImageFormatNotSupported"), LOG_WARNING);
}
} else {
$message .= '<div class="error">' . $langs->trans("ErrorFileDoesNotExists", $_GET["file"]) . '</div>';
dol_syslog($langs->transnoentities("ErrorFileDoesNotExists", $_GET["file"]), LOG_WARNING);