23if (!defined(
'NOREQUIRESOC')) {
24 define(
'NOREQUIRESOC',
'1');
27if (!defined(
'NOTOKENRENEWAL')) {
28 define(
'NOTOKENRENEWAL',
'1');
30if (!defined(
'NOREQUIREMENU')) {
31 define(
'NOREQUIREMENU',
'1');
33if (!defined(
'NOREQUIREHTML')) {
34 define(
'NOREQUIREHTML',
'1');
36if (!defined(
'NOREQUIREAJAX')) {
37 define(
'NOREQUIREAJAX',
'1');
40if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
41 require
'../../main.inc.php';
47$query =
GETPOST(
'query',
'alpha');
49if (!isModEnabled(
'takepos')) {
59 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
60 require_once DOL_DOCUMENT_ROOT.
'/core/lib/categories.lib.php';
65 $upload_dir = $conf->categorie->multidir_output[
$object->entity];
66 $pdir =
get_exdir(
$object->id, 2, 0, 0, $object,
'category').$object->id.
"/photos/";
67 $dir = $upload_dir.
'/'.$pdir;
69 foreach (
$object->liste_photos($dir) as $key => $obj) {
70 if ($obj[
'photo_vignette']) {
71 $filename = $obj[
'photo_vignette'];
73 $filename = $obj[
'photo'];
75 $file = DOL_URL_ROOT.
'/viewimage.php?cache=1&publictakepos=1&modulepart=category&entity='.
$object->entity.
'&file='.urlencode($pdir.$filename);
76 header(
'Location: '.$file);
79 header(
'Location: ../../public/theme/common/nophoto.png');
81} elseif ($query ==
"pro") {
82 require_once DOL_DOCUMENT_ROOT.
"/product/class/product.class.php";
86 $image = $objProd->show_photos(
'product', $conf->product->multidir_output[$objProd->entity],
'small', 1);
89 preg_match(
'@src="([^"]+)"@', $image, $match);
90 $file = array_pop($match);
92 header(
'Location: ../../public/theme/common/nophoto.png');
95 if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
96 header(
'Location: '.$file.
'&cache=1');
99 header(
'Location: '.$file.
'&cache=1&publictakepos=1&modulepart=product');
107 $filename = $query.
".jpg";
110 list($width, $height) = getimagesize($filename);
115 $image_p = imagecreatetruecolor($new_width, $new_height);
116 $image = imagecreatefromjpeg($filename);
117 imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
120 imagejpeg($image_p,
null, 100);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to manage categories.
Class to manage products or services.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.