Luxbum.net - Script de galerie photo

Ticket #26 (assigned Demande de fonctionnalité)

Opened 8 months ago

Last modified 8 months ago

Rotation des images à partir de l'orientation exif

Reported by: michael Assigned to: nicolas (accepted)
Priority: mineur Milestone: 1.0
Component: api Version: 1.0
Keywords: rotation orientation exif Cc:

Description (Last modified by nicolas)

Les nouveaux appareils photo enregistrent l'orientation de la photo au moment de sa numérisation. On pourrait donc utiliser ce champ exif pour mettre les photos dans le bon sens :

  • pour l'affichage des photos
  • pour le diaporama

Change History

04/01/08 15:17:05 changed by nicolas

  • description changed.

04/01/08 15:17:25 changed by nicolas

  • description changed.

04/01/08 15:18:48 changed by nicolas

  • status changed from new to assigned.

04/01/08 15:19:40 changed by nicolas

c'était dans mes objectifs, j'avais déjà trouvé ce lien qui me sera très utile : http://www.thescripts.com/forum/thread641481.html

04/01/08 15:28:34 changed by nicolas

<?php
$o = $exif["IFD0"]["Orientation"]; // $exif is the array returned by exif_read_data()
$rotate = 0; // how many degrees the image should be rotated
$flip = false; // need to flip horizontally
switch($o) {
   case 1:
      $rotate = 0;
      $flip = false;
      break;

   case 2:
      $rotate = 0;
      $flip = true;
      break;

   case 3:
      $rotate = 180;
      $flip = false;
      break;

   case 4:
      $rotate = 180;
      $flip = true;
      break;

   case 5:
      $rotate = 90;
      $flip = true;
      break;

   case 6:
      $rotate = 90;
      $flip = false;
      break;

   case 7:
      $rotate = 270;
      $flip = true;
      break;

   case 8:
      $rotate = 270;
      $flip = false;
      break;
}
?>