使用图像重定向到新目录

时间:2014-12-22 19:01:51

标签: javascript php jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<?php include 'header.php';?>
  <!--<div id="metro-container" class="-container">-->
         <!--<div class="row">-->
            <!--<div id="hub" class="metro">-->
               <div class="metro panorama">
                  <div class="panorama-sections">
   
                     <div class="panorama-section">
<!DOCTYPE html>
<h2>iPhone 5</h2>
<script type="text/javascript">
function image(img) {
    var src = img.src;
    window.open(src);
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/>
<title>Pictures</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
 
<div class="container">
	<div class="row">

<?php
date_default_timezone_set("Europe/Copenhagen");
$folder = 'photos/iphone5/';
$filetype = '*.*';
$files = glob($folder.$filetype);
$count = count($files);
 
$sortedArray = array();
for ($i = 0; $i < $count; $i++) {
    $sortedArray[date ('YmdHis', filemtime($files[$i])) . $i] = $files[$i];
}
 
ksort($sortedArray);
# krsort($sortedArray);
foreach ($sortedArray as $filename) {
	//echo $filename;
	echo '<img src="'.$filename.'"onclick="image(this)" title="' . substr($filename,strlen($folder),strpos($filename, '.')-strlen($folder)) . '" />';
}
?>

	</div>
</div>

</body>
</html>
<?php include 'footer.php';?>

所以基本上这样做的是当有人点击图像时,它会将它们重定向到新窗口中的图像。我在文件夹/ p​​hotos / iphone5中创建了较小的图像,如果点击它,我会怎么做才能将它们重定向到文件夹/ p​​hotos / iphone5 / full中的全尺寸图像..

0 个答案:

没有答案