20 if (!defined(
'NOREQUIRESOC')) define(
'NOREQUIRESOC',
'1');
22 if (!defined(
'NOCSRFCHECK')) define(
'NOCSRFCHECK',
'1');
23 if (!defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL',
'1');
24 if (!defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
25 if (!defined(
'NOREQUIREHTML')) define(
'NOREQUIREHTML',
'1');
26 if (!defined(
'NOREQUIREAJAX')) define(
'NOREQUIREAJAX',
'1');
28 if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require
'../../main.inc.php';
33 $query =
GETPOST(
'query',
'alpha');
43 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/categories.lib.php';
47 $result = $object->fetch($id);
49 $upload_dir = $conf->categorie->multidir_output[$object->entity];
50 $pdir =
get_exdir($object->id, 2, 0, 0, $object,
'category').$object->id.
"/photos/";
51 $dir = $upload_dir.
'/'.$pdir;
53 foreach ($object->liste_photos($dir) as $key => $obj)
55 if ($obj[
'photo_vignette'])
57 $filename = $obj[
'photo_vignette'];
59 $filename = $obj[
'photo'];
61 $file = DOL_URL_ROOT.
'/viewimage.php?cache=1&publictakepos=1&modulepart=category&entity='.$object->entity.
'&file='.urlencode($pdir.$filename);
62 header(
'Location: '.$file);
65 header(
'Location: ../../public/theme/common/nophoto.png');
66 } elseif ($query ==
"pro")
68 require_once DOL_DOCUMENT_ROOT.
"/product/class/product.class.php";
72 $image = $objProd->show_photos(
'product', $conf->product->multidir_output[$objProd->entity],
'small', 1);
74 preg_match(
'@src="([^"]+)"@', $image, $match);
75 $file = array_pop($match);
77 header(
'Location: ../../public/theme/common/nophoto.png');
79 if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
80 header(
'Location: '.$file.
'&cache=1');
82 header(
'Location: '.$file.
'&cache=1&publictakepos=1&modulepart=product');
89 $filename = $query.
".jpg";
92 list($width, $height) = getimagesize($filename);
97 $image_p = imagecreatetruecolor($new_width, $new_height);
98 $image = imagecreatefromjpeg($filename);
99 imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
102 imagejpeg($image_p, null, 100);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage products or services.
Class to manage categories.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...