Site web des serveurs MineTest Juneland
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

136 lines
2.4 KiB

<?php
if ($_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '127.0.0.1') {
// Adaptez la ligne suivante à votre configuration
define('ROOT_URL', '/juneland/');
} else {
define('ROOT_URL', '/');
}
define('DEFAULT_TITLE', 'Juneland');
$acceptedWidth = array(267, 303, 298, 392, 400, 408, 463, 502, 612, 620, 628, 832, 840, 848, 942);
$imgLayouts = [
'col_3_2_1_bordered' => [
'w' => [400, 620],
'breakpoints' => '
(max-width: 42.249rem) 400px,
(max-width: 55.999rem) 620px,
400px
'
],
'col_3_2_1' => [
'w' => [408, 628],
'breakpoints' => '
(max-width: 42.249rem) 408px,
(max-width: 55.999rem) 628px,
408px
',
],
'col_2_1_bordered' => [
'w' => [400, 620, 840],
'breakpoints' => '
(max-width: 42.249rem) 400px,
(max-width: 55.999rem) 620px,
(max-width: 83.490rem) 840px,
620px
',
],
'col_2_1' => [
'w' => [408, 628, 848],
'breakpoints' => '
(max-width: 42.249rem) 408px,
(max-width: 55.999rem) 628px,
(max-width: 83.490rem) 848px,
628px
',
],
'article_full_width' => [
'w' => [392, 502, 612, 832, 942],
'breakpoints' => '
(max-width: 35.374rem) 392px,
(max-width: 42.249rem) 502px,
(max-width: 55.999rem) 612px,
(max-width: 83.499rem) 832px,
942px
',
],
'gallery_3_2_1' => [
'w' => [502, 298, 267, 303],
'breakpoints' => '
(max-width: 42.249rem) 502px,
(max-width: 55.999rem) 298px,
(max-width: 84.499rem) 267px,
303px
',
],
'gallery_2_1' => [
'w' => [612, 408, 463],
'breakpoints' => '
(max-width: 55.999rem) 612px,
(max-width: 84.499rem) 408px,
463px
',
],
];
$thumbExt = '.jpg';
function image ($filename, $alt, $layout) {
global $thumbExt;
$imgName = substr($filename, 0, strrpos($filename, '.'));
$out = '';
$out .= '<img ';
$out .= ' src="'. ROOT_URL .'img/'. $filename .'"';
$out .= ' srcset="';
$first = true;
foreach ($layout['w'] as $w) {
if ($first) {
$first = false;
} else {
$out .= ', ';
}
$out .= ROOT_URL .'thumbs/'. $w . 'w/'. $imgName . $thumbExt .' '. $w . 'w';
}
$out .= '" ';
$out .= ' sizes="' . $layout['breakpoints'] . '"';
$out .= ' alt="'. $alt .'"';
$out .= ' />';
return $out;
}