Titre: modif
Posté par: mike501 le le 08-05-2005 a 14:28:16
je vien de telecharger un code mais le souci c est que quan j ouvre une image il me la mais sur la meme page et j aimerai que vous m aidez pour modifier le code pour que quand je clique sur une image elle s ouvre dans une autre fenetre voici le code
<?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";
} } ?>
|
Titre: Re:modif
Posté par: Cellimo le le 08-05-2005 a 17:14:53
euh je crois que ce topic aurait plus sa place dans la partie php/mysql...
maintenant c'est vrai qu'il y a beaucoup de code, et que on y voit pas tres clair, est-ce que tu pourrai mettre ce que tu as fait online pour qu'on puisse voir un exemple ? :P |
Titre: Re:modif
Posté par: mike501 le le 08-05-2005 a 18:42:34
voici l exemple
http://www.wallpaperfusion.free.fr/wallpaperfusion_tribal.htm |
Titre: Re:modif
Posté par: Cellimo le le 08-05-2005 a 18:55:12
quand on fé ajouter une nouvelle foto, ca marche pas...
|
Titre: Re:modif
Posté par: D@nny le le 08-05-2005 a 19:56:43
essaie ca
<?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,'" target=_blank>',"\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,'" target=_blank>',"\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,'" target=_blank>',"\n"; echo '<img src="',$image_path,'/thumb/',$file_photo,'" border="0"></a>',"\n"; echo '<center></td>',"\n";
} } ?>
C'est au hasard, j'ai juste rajouter des petit truc, mais je sais pas si sa va marcher |
Forum-webmaster | Actionné par YaBB SE
© 2001-2003, YaBB SE Dev Team. Tous droits réservés.
|