255,9 → 255,22 |
} |
|
// téléchargement de l'image PN |
$img = false; |
$retry = 3; |
do { |
$img = file_get_contents($image['o']); |
$retry--; |
} while (!$img && $retry); |
|
if (!$img) { |
echo "Abandon, image impossible à télécharger : {$image['o']}\n"; |
continue; |
} |
|
// Écriture dans un fichier temporaire |
$tempfile = tempnam("/tmp", "PullPN_") . ".jpg"; |
$handle = fopen($tempfile, "w"); |
fwrite($handle, file_get_contents($image['o'])); |
fwrite($handle, $img); |
fclose($handle); |
|
echo "Image de " . number_format(filesize($tempfile), 0, ',', ' ') . " octets créé : $tempfile\n"; |