"; echo '' . debug_backtrace()[0]['file'] . ' ' . debug_backtrace()[0]['line'] . ''; echo ""; echo '
';
if(is_array($d)) {
print_r($d);
} else if(is_object($d)) {
var_dump($d);
}
echo '';
}
/**
* Simple helper to debug to the console
*
* @param Array, Object, String $data
* @return String
*/
function debug_to_console( $data ) {
$output = '';
if ( is_array( $data ) ) {
$output .= "";
} else if ( is_object( $data ) ) {
$data = var_export( $data, TRUE );
$data = explode( "\n", $data );
foreach( $data as $line ) {
if ( trim( $line ) ) {
$line = addslashes( $line );
$output .= "console.log( '{$line}' );";
}
}
$output = "";
} else {
$output .= "";
}
echo $output;
}
/* Fonction month(): convertit le mois (nb) en mois (texte) francais
photo-du-mois.php
*/
function convert_bytes($val , $type_val , $type_wanted){
$tab_val = array("o", "ko", "Mo", "Go", "To", "Po", "Eo");
if (!(in_array($type_val, $tab_val) && in_array($type_wanted, $tab_val)))
return 0;
$tab = array_flip($tab_val);
$diff = $tab[$type_val] - $tab[$type_wanted];
if ($diff > 0)
return ($val * pow(1024, $diff));
if ($diff < 0)
return ($val / pow(1024, -$diff));
return ($val);
}
function taille_fichier($octets) {
$resultat = $octets;
for ($i=0; $i < 8 && $resultat >= 1024; $i++) {
$resultat = $resultat / 1024;
}
if ($i > 0) {
return preg_replace('/,00$/', '', number_format($resultat, 2, ',', ''))
. ' ' . substr('KMGTPEZY',$i-1,1) . 'o';
} else {
return $resultat . ' o';
}
}
function formatBytes($bytes, $precision = 2) {
$units = array('o', 'Ko', 'Mo', 'Go', 'To');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
// Uncomment one of the following alternatives
// $bytes /= pow(1024, $pow);
$bytes /= (1 << (10 * $pow));
return round($bytes, $precision) . " " .$units[$pow];
}
function month($w) {
$m = date('m', strtotime($w)); // month
$y = date('Y', strtotime($w)); // year
$locale = getenv('LC_ALL=');
$dateFormatter = new IntlDateFormatter(
$locale,
IntlDateFormatter::LONG, // date type
IntlDateFormatter::NONE // time type
);
$dateFormatter->setPattern('LLLL'); // full month name with NO DECLENSION ;-)
$months_locale = [];
for ($month_number = 1; $month_number <= 12; ++$month_number) {
$months_locale[] = $dateFormatter->format(
// 'n' => month number with no leading zeros
DateTime::createFromFormat('n', (string)$month_number)
);
}
array_unshift($months_locale,"");
unset($months_locale[0]);
$my = ucfirst($months_locale[(int)$m]) . " " . $y;
return $my;
}
/* Fonctions get_gps() et gps2Num(): extrait les coord GPS depuis les exifs
insert_bdd.php
*/
function gps2Num($coordPart){
/*
Array
(
[0] => 46/1
[1] => 408587/10000
[2] => 0/0
)
Array
(
[0] => 5/1
[1] => 562596/10000
[2] => 0/0
)
*/
$parts = explode('/', $coordPart);
//echo $parts[0].'-'.$parts[1].'| " . gettext("Date") . " | " . $dateoriginal . " |
| " . gettext("Speed") . " | " . $speed . " |
| " . gettext("Aperture") . " | " . $aperture . " |
| " . gettext("Iso") . " | " . $iso . " |
| " . gettext("Model") . " | ". $model . " |
| " . gettext("Lens") . " | " . $objectif . " |
| " . gettext("Focal") . " | " . $focal . " |
| " . gettext("Exposure Correction") . " | " . $correctexpo . " |
| " . gettext("Metering") . " | ". $metering . " |
| " . gettext("Program") . " | " . $program . " |
| " . gettext("White balance") . " | " . $wb . " |
| " . gettext("Flash") . " | " . $flash . " |
| " . gettext("Software") . " | " . $software . " |
| " . gettext("Keywords") . " | " . $keywords . " |
| " . gettext("Copyright") . " | " . $copyright . " |
| " . gettext("City") . " | " . $city . " |
| " . gettext("Department") . " | " . $department . " |
| " . gettext("Country") . " | " . $country . $code . " |
| GPS | " . $map . " |
| " . gettext("Comment") . " | " . $comment . " |
| " . gettext("User comment") . " | " . $usercomment . " |