Bonjour a tous,

je suis entrain de tester un script qui liste toutes les images stockees dans un dossier uploads et leur attribue un lien.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<html>
	<head>
	<title>Images</title>
	<style type="text/css" title="text/css" media="all">
	.error {
		fon-weight: bold;
		color: #C00
		}
	</style>
	<script language="JavaScript">
	<!-- // Hide from old browsers.
	function create_window(image, width, height){
		width=width+10;
		height=height+10;
		if (window.popup && ! window.popup.closed){
			window.popup.resizeTo(width, height);
		}
		var specs="location=no, scrollbars=no, menubars=no, toolbars=no, resizable=yes, left=0, top=0, width=" + width + ", height=" + height;
		var url="show_images.php?image=" + image;
		popup=window.open(url, "ImageWindow", specs);
		popup.focus();
	}
	//--></script>
	</head>
	<body>
	<p> click on an image to view it in a separate window.</p>
	<table align="center" cellspacing="5" cellpadding="5" border="1">
		<tr>
			<td align="center"><b>Image name</b></td>
			<td align="center"><b>Image Size</b></td>
		</tr>
		<?php
		$dir='../../uploads';
		$files=scandir($dir);
		foreach ($files as $image){
			if ((substr($image, 0, 1)!='.') && ($image!='Thumbs.db')){
				$image_size= getimagesize ("$dir/&image");
				$file_size=round((filesize("$dir/&image"))/1024) . "kb";
				$image=urlencode($image);
				echo "\t<tr>
				\t\t<td><a href=\"javascript:create_window('$image',$image_size[0],$image_size[1])\">$image</a></td>
				\t\t<td>$file_size</td>
				\t</tr>\n";
			}
		}
		?>
	</table>
	</body>
</html>
mais voila, quand je le teste, voila ce que j'obtiens comme erreur:

Warning: getimagesize(../../uploads/&image) [function.getimagesize]: failed to open stream: No such file or directory in D:\wamp\www\PHP-TESTS\images.php on line 37

Warning: filesize() [function.filesize]: stat failed for ../../uploads/&image in D:\wamp\www\PHP-TESTS\images.php on line 38
800px-Uml_diagram.svg.png 0kb
les lignes 37 et 38 sont les suivantes:

$image_size= getimagesize ("$dir/&image");
$file_size=round((filesize("$dir/&image"))/1024) . "kb";
je vois bien tous les fichiers avec leur liens dans un tableau mais la taille est 0 kb.

Qu'est ce qui s'est passe?

Merci

Billyrose