当前位置: 首页>>代码示例>>PHP>>正文


PHP Categorie::liste_photos方法代码示例

本文整理汇总了PHP中Categorie::liste_photos方法的典型用法代码示例。如果您正苦于以下问题:PHP Categorie::liste_photos方法的具体用法?PHP Categorie::liste_photos怎么用?PHP Categorie::liste_photos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Categorie的用法示例。


在下文中一共展示了Categorie::liste_photos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GETPOST

// For "custom" directory
$id = GETPOST('id');
$w = GETPOST('w');
$h = GETPOST('h');
$query = GETPOST('query');
// Content type
header('Content-Type: image/jpeg');
if ($query == "cat") {
    require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
    require_once DOL_DOCUMENT_ROOT . '/core/lib/categories.lib.php';
    $object = new Categorie($db);
    $result = $object->fetch($id);
    $upload_dir = $conf->categorie->multidir_output[$object->entity];
    $pdir = get_exdir($object->id, 2) . $object->id . "/photos/";
    $dir = $upload_dir . '/' . $pdir;
    foreach ($object->liste_photos($dir) as $key => $obj) {
        $filename = $obj['photo'];
    }
    // The file
    $filename = $dir . $filename;
    if (!file_exists($filename)) {
        $filename = "empty.jpg";
    }
    // Dimensions
    list($width, $height) = getimagesize($filename);
    $new_width = $w;
    $new_height = $h;
    // Resample
    $image_p = imagecreatetruecolor($new_width, $new_height);
    $image = imagecreatefromjpeg($filename);
    imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:31,代码来源:index.php

示例2: getImageCategory

 /**
  *  Return path of a catergory image 
  *  @param 		int 	$idCat		Id of Category
  *  @param		bool	$thumb		If enabled use thumb
  *  @return      string				Image path
  */
 public static function getImageCategory($idCat)
 {
     global $conf, $db;
     $extName = "_small";
     $extImgTarget = ".jpg";
     $outDir = "pos";
     $maxWidth = 90;
     $maxHeight = 90;
     $quality = 50;
     if ($idCat > 0) {
         $objCat = new Categorie($db);
         $objCat->fetch($idCat);
         $pdir = get_exdir($idCat, 2) . $idCat . "/photos/";
         $dir = $conf->categorie->multidir_output[$objCat->entity] . '/' . $pdir;
         foreach ($objCat->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);
                 }
             }
             $filename = $outDir . '/' . $fileName . $extName . $extImgTarget;
             $realpath = DOL_URL_ROOT . '/viewimage.php?modulepart=category&entity=' . $objCat->entity . '&file=' . urlencode($pdir . $filename);
         }
         if (!$realpath) {
             $realpath = DOL_URL_ROOT . '/viewimage.php?modulepart=product&file=' . urlencode('noimage.jpg');
         }
         return $realpath;
     }
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:43,代码来源:pos.class.mañanero.php

示例3: getCategory

/**
 * Get category infos and children
 *
 * @param	array		$authentication		Array of authentication information
 * @param	int			$id					Id of object
 * @return	mixed
 */
function getCategory($authentication, $id)
{
    global $db, $conf, $langs;
    dol_syslog("Function: getCategory login=" . $authentication['login'] . " id=" . $id);
    if ($authentication['entity']) {
        $conf->entity = $authentication['entity'];
    }
    $objectresp = array();
    $errorcode = '';
    $errorlabel = '';
    $error = 0;
    $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
    if (!$error && !$id) {
        $error++;
        $errorcode = 'BAD_PARAMETERS';
        $errorlabel = "Parameter id must be provided.";
    }
    if (!$error) {
        $fuser->getrights();
        if ($fuser->rights->categorie->lire) {
            $categorie = new Categorie($db);
            $result = $categorie->fetch($id);
            if ($result > 0) {
                $dir = !empty($conf->categorie->dir_output) ? $conf->categorie->dir_output : $conf->service->dir_output;
                $pdir = get_exdir($categorie->id, 2) . $categorie->id . "/photos/";
                $dir = $dir . '/' . $pdir;
                $cat = array('id' => $categorie->id, 'id_mere' => $categorie->id_mere, 'label' => $categorie->label, 'description' => $categorie->description, 'socid' => $categorie->socid, 'type' => $categorie->type, 'dir' => $pdir, 'photos' => $categorie->liste_photos($dir, $nbmax = 10));
                $cats = $categorie->get_filles();
                if (count($cats) > 0) {
                    foreach ($cats as $fille) {
                        $dir = !empty($conf->categorie->dir_output) ? $conf->categorie->dir_output : $conf->service->dir_output;
                        $pdir = get_exdir($fille->id, 2) . $fille->id . "/photos/";
                        $dir = $dir . '/' . $pdir;
                        $cat['filles'][] = array('id' => $fille->id, 'id_mere' => $categorie->id_mere, 'label' => $fille->label, 'description' => $fille->description, 'socid' => $fille->socid, 'type' => $fille->type, 'dir' => $pdir, 'photos' => $fille->liste_photos($dir, $nbmax = 10));
                    }
                }
                // Create
                $objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'categorie' => $cat);
            } else {
                $error++;
                $errorcode = 'NOT_FOUND';
                $errorlabel = 'Object not found for id=' . $id;
            }
        } else {
            $error++;
            $errorcode = 'PERMISSION_DENIED';
            $errorlabel = 'User does not have permission for this request';
        }
    }
    if ($error) {
        $objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
    }
    return $objectresp;
}
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:61,代码来源:server_category.php


注:本文中的Categorie::liste_photos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。