La Communauté Webmaster  forum rss


  Forum-webmaster
  Technique - programmation
  Javascript / DOM / Ajax
(Modérateurs: Shain, Netah, Lilian, lauryv, ToToMaStEr)
  modif de code
« Précédent Suivant »
Pages: [1] Descendre
Répondre    Aviser des réponses    Envoyer le sujet    Imprimer
  Auteur  Sujet: modif de code  (Lu 642 fois)
modif de code
« sur: le 13-05-2005 a 18:12:34 »
mike501
Membre récent
*

Hors-Ligne

Messages: 17



Je suis un lama!

Voir le Profil    E-Mail
Répondre avec citation

Bonjour

je vien de telecharger un code mais je voudrai que les images s ouvre dans une autre fenetre (pop up) pouvez vous m aidez.




<?php
  error_reporting(E_ALL);
function thumb($photo,$grand,$destination){

      $fichierSource = $photo;

      $source = ImageCreateFromJpeg("./img/".$fichierSource);

      $largeurSource = imagesx($source);
      $hauteurSource = imagesy($source);

      $rapport_dim= $largeurSource / $hauteurSource;

     

      if ( $largeurSource >= $hauteurSource ) {
          $largeurDestination = $grand;
          $hauteurDestination = $largeurDestination / $rapport_dim;
      }
      else {
          $hauteurDestination = $grand;
          $largeurDestination = $hauteurDestination * $rapport_dim;
      }



      $im = ImageCreateTrueColor ($largeurDestination, $hauteurDestination)
              or die ('Erreur lors de la création de l\'image');

      ImageCopyResampled($im, $source, 0, 0, 0, 0, $largeurDestination, $hauteurDestination, $largeurSource, $hauteurSource);


      ImageJpeg ($im, "$destination/$fichierSource");


}



function knowdir($path){

    $path=dirname($path);

    $path=strrchr($path,"/");
    return $path;
}





include ('../inc/config.php');

$dir=knowdir($_SERVER['PHP_SELF']);
$image_path=$path."galerie/$dir" ;

//création du tableau des photos
$dir_connect=opendir("./img");

$table_id=1;



while($file=readdir($dir_connect)) {
    $photos_tab[$table_id]=$file;
    $table_id++;
}

sort($photos_tab);

$dir_sans=str_replace(' ','%20',$dir);


echo '<center><h2>',$dir,' :</h2></center>';
echo '<br /><br /><br /><center>',"\n";
echo '<a href="',$path,$nom_index,'galerie',$dir_sans,'" onClick=window.open("',$path,'galerie',$dir_sans,'/new.php","new_photo","status=no,scrollbars=yes,width=450,height=500,directories=no,location=no,resizable=yes,toolbar=no");>Ajouter une nouvelle photo</a>',"\n";
echo '<table border="0" width="100%"><tr>',"\n";

if ( ! isset($_GET['photo_id'])) {

    $table_read=2;
    echo '<table color="',$table_color,'"><tr>';


    while ( @$file_photo=$photos_tab[$table_read] ) {
   
            if (!$redim) {
                $dim_thumb='';
            }
            else {
                $hauteur_thumb1=3/4 *  $dim_thumb1;
                $dim_thumb='width="'.$dim_thumb1.'" height="'.$hauteur_thumb1.'"';
            }
            echo '<td>',"\n";
            echo '<center><a href="',$path,$nom_index,'galerie',$dir,'/index.php?photo_id=',$table_read,'">',"\n";
            echo '<img src="',$image_path,'/thumb/',$file_photo,'" border="0" ',$dim_thumb,'></a><center></td>',"\n\n\n";

            if (!is_file('./thumb/'.$file_photo)) {
                thumb($file_photo,$dim_thumb1,'./thumb');

            }
   
          if (!is_file('./thumb2/'.$file_photo)) {
              thumb($file_photo,$dim_thumb2,'./thumb2');
          }

            if ( intval(($table_read+($nb_photo_col-1))/$nb_photo_col) == ($table_read+($nb_photo_col-1))/$nb_photo_col and $table_read+2!=$nb_photo_col) {
                echo '</tr><tr>';
            }

            $table_read ++;
    }
   
   


}
else {
    $photo_id=$_GET['photo_id'];
   
   
   
   
    if ($photo_id!=2) {
        $file_photo=$photos_tab[$photo_id-1];
   
        if (!is_file("./thumb/$file_photo")) {
            thumb($file_photo,$dim_thumb1,"./thumb");
        }
        $photos_prec=$photo_id-1;
        echo '<td width="20%"><center><a href="',$path,$nom_index,'galerie'.$dir.'/index.php?photo_id=',$photos_prec,'">',"\n";
        echo '<img src="',$image_path,'/thumb/',$file_photo,'" border="0"></a><center></td>',"\n";
    }

   

    $file_photo=$photos_tab[$photo_id];
   

        if (!is_file("./thumb2/$file_photo")) {
            thumb($file_photo,$dim_thumb2,"./thumb2");
        }
    $link_file=str_replace(" ","%20",$file_photo);
    echo '<td><center><a href="',$path,$nom_index,'galerie',$dir,'/index.php?photo_id=',$photo_id,'" ',"\n";
    echo 'onClick=window.open("',$path,'galerie',$dir,'/img/',$link_file,'");>',"\n";
    echo '<img src="',$image_path,'/thumb2/',$file_photo,'" border="0"></a>',"\n";
    echo '<center></td>',"\n";


    if (@ $file_photo=$photos_tab[$photo_id+1] ) {
   
        if (!is_file('./thumb/'.$file_photo)) {
            thumb($file_photo,$dim_thumb1,'./thumb');
        }
            $photos_suiv=$photo_id+1;

        echo '<td width="20%"><center><a href="',$path,$nom_index,'galerie',$dir,'/index.php?photo_id=',$photos_suiv,'">',"\n";
        echo '<img src="',$image_path,'/thumb/',$file_photo,'" border="0"></a>',"\n";
        echo '<center></td>',"\n";

    }
  }
?>

Rapporter au modérateur  
Répondre    Aviser des réponses    Envoyer le sujet    Imprimer
Pages: [1] Monter
« Précédent Suivant »
Sauter à: 

Votre statut : Invité
Vous devez être membre pour participer.
 
 
Let’s Encrypt : le certificat SSL gratuit
Tester votre site internet sur différents navigateurs
[WordPress] Des problèmes avec l’administration ?
Rappel : Mettez à jour vos CMS et vos sites E-commerce
Le .fr fête ses 25 années d’existence !
Mesurer votre audience en temps réel avec BubbleStat
Porter réclamation contre Google Panda ?
Zlio n’est plus …
 
 
 
 
 

Copyright (c) Devclic 2002 - 2026 - Tous droits réservés

creation site internet strasbourg