Crabs Contents Management System

crabs_cms-1.0.4 ©2006-2008 - Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)

~~ / MEMBRE / GESTION / photo_download.php
Makefile gestion.xsl gestion.css saisie.js index.php index_publie.php tout_publier.php tout_publier.js dossier.php dossier_ajout.php dossier_ajout_done.php dossier_done.php dossier_publie.php dossier_suppr.php article.php article_ajout.php article_done.php article_publie.php article_liste.php article_info.php article_suppr.php document.php document_upload.php document_suppr.php document_liste.php image.php image_upload.php image_suppr.php image_liste.php image_info.php photo.js photo.php photo_upload.php photo_download.php photo_album_modif.php photo_modif.php photo_liste.php photo_info.php photo_album_liste.php photo_album_info.php news.php news_ajout.php news_modifier.php news_done.php news_publie.php editeur.js fichier.php fichier_done.php fichier_cnt.php profil.php profil_done.php passwd.php membre.php calendrier.php calendrier.js cal_done.php forum.php forum.js forum_modif.php
    1 <?php
    2 //
    3 // =============================================================================
    4 //  crabs_cms-1.0.4 : Crabs Contents Management System
    5 //  Copyright (C) 2006-2008 : Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)
    6 //
    7 //  Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer
    8 //  et/ou le modifier en respectant les termes de la GNU General Public License
    9 //  version 2 ou (suite a votre propre choix) une version ulterieure.
   10 //
   11 //  Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais
   12 //  sans aucune garantie, meme si il est associe a un produit qui vous en
   13 //  propose une. Conformez-vous a la GNU General Public License pour avoir
   14 //  plus de precisions.
   15 //
   16 //  L'auteur ne peut etre tenu responsable de l'utilisation faite des
   17 //  composantes associees a ce projet (en partie ou dans leur totalite).
   18 //
   19 //  Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC
   20 //  de ce projet sous le nom gnu_gpl.txt
   21 //
   22 // =============================================================================
   23 //
   24 $RACINE='../..' ;
   25 include( $RACINE.'/pinfo.php' ) ;
   26 include( $RACINE.'/LIB/param.php' ) ;
   27 include( $RACINE.'/LIB/util.php' ) ;
   28 include( $RACINE.'/LIB/mysql.php' ) ;
   29 include( $RACINE.'/LIB/xml.php' ) ;
   30 
   31 include( $RACINE.'/LIB/only_session.php' ) ;
   32 
   33 $rd = $RACINE.'/PHOTOS/DOWNLOAD' ;
   34 $dir = opendir( $rd ) ; $files = array() ;
   35 while ( $entry = readdir( $dir ) )
   36     if ( is_file( $rd.'/'.$entry ) ) $files[] = $entry ;
   37 natsort( $files ) ;
   38 $c = new MYSQL ;
   39 
   40 foreach( $files as $entry )
   41     {
   42     $file = $rd.'/'.$entry ;
   43     $info = getimagesize( $file ) ;
   44     if ( $info[2] == 2 ) // JPEG
   45         { $gd = imagecreatefromjpeg( $file ) ; $transform=false ; }
   46     else if ( $info[2] == 3 ) // PNG
   47         { $gd = imagecreatefrompng( $file ) ; $transform=true ; }
   48     else
   49         continue ;
   50     $w = $info[0] ; $h = $info[1] ;
   51     $name = md5( $entry.time() ) ;
   52     $image_file = $RACINE.'/PHOTOS/IMAGES/'.$name.'.jpeg' ;
   53     $vign_file = $RACINE.'/PHOTOS/VIGNETTES/'.$name.'.jpeg' ;
   54     if ( $w > $h )  { $tw = 100 ; $th = ( $h * 100 ) / $w ; }
   55              else   { $th = 100 ; $tw = ( $w * 100 ) / $h ; }
   56     $tw = (int) $tw ; $th = (int) $th ;
   57     $ith = imagecreatetruecolor( $tw, $th ) ;
   58     imagecopyresized( $ith, $gd, 0,0, 0,0, $tw,$th, $w,$h ) ;
   59     if ( $transform )
   60         {
   61         imagejpeg( $gd, $image_file ) ;
   62         unlink( $file ) ;
   63         }
   64     else
   65         rename( $file, $image_file ) ;
   66     imagejpeg( $ith, $vign_file ) ;
   67     imagedestroy( $ith ) ;
   68     imagedestroy( $gd ) ;
   69     $sql = <<<SQL
   70         INSERT INTO ${DB_PRFX}phf VALUES
   71             ('', 1, '$entry', '$name', '', $w, $h, $tw, $th )
   72 SQL;
   73     $c->query( $sql ) ;
   74     }
   75 header( 'Location: photo.php?a=1' ) ;
   76 ?>
Makefile gestion.xsl gestion.css saisie.js index.php index_publie.php tout_publier.php tout_publier.js dossier.php dossier_ajout.php dossier_ajout_done.php dossier_done.php dossier_publie.php dossier_suppr.php article.php article_ajout.php article_done.php article_publie.php article_liste.php article_info.php article_suppr.php document.php document_upload.php document_suppr.php document_liste.php image.php image_upload.php image_suppr.php image_liste.php image_info.php photo.js photo.php photo_upload.php photo_download.php photo_album_modif.php photo_modif.php photo_liste.php photo_info.php photo_album_liste.php photo_album_info.php news.php news_ajout.php news_modifier.php news_done.php news_publie.php editeur.js fichier.php fichier_done.php fichier_cnt.php profil.php profil_done.php passwd.php membre.php calendrier.php calendrier.js cal_done.php forum.php forum.js forum_modif.php
~~ / MEMBRE / GESTION / photo_download.php

Haut de page

Contacter crabs

Date de génération : 24/10/2008 21:34