Forum-webmaster
Technique - programmation => Javascript / DOM / Ajax => Message commencé par: mike501 le le 13-05-2005 a 18:12:34

Titre: modif de code
Posté par: mike501 le le 13-05-2005 a 18:12:34

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";

}
}
?>


Forum-webmaster | Actionné par YaBB SE
© 2001-2003, YaBB SE Dev Team. Tous droits réservés.