Path werkt niet bij afbeelding
Goedendag, ik heb een image slider en een gallery die worden getoond als ingeladen pagina op de website. Los hiervan had ik ze functioneel maar zodra ze in de hoofdpagina geladen worden gaat het mis. Plaatjes worden niet gevonden dus heb ik de paden gecheckt maar waar ik ook mogelijk paden verander, gebeurt er niets. Nu mijn vraag: Moet ik op de één of andere manier de functies die worden aangeroepen ook voorzien van een pad o.i.d.? Dat het daar misgaat?
Mijn website heeft deze structuur:
Root
|
Map:Test (tijdelijk to hij werkt)
index.html (laadt die php pagina's in)
|
Map: imageSlider
index.php
Map: imageGallery
index.php
----------
Code index.php
---------
---------------
Code load_images.php
---------------
Mijn website heeft deze structuur:
Root
|
Map:Test (tijdelijk to hij werkt)
index.html (laadt die php pagina's in)
|
Map: imageSlider
index.php
Map: imageGallery
index.php
----------
Code index.php
---------
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Image Gallery</title>
<link rel="stylesheet" href="imageGallery/style.css">
</head>
<body>
<div id="gallery">
<?php include 'imageGallery/load_images.php'; ?>
</div>
<div id="popup" style="display:none;" onclick="closePopup()"> <img id="popup-img" src="" alt="Large image" onclick="closePopup()">
<p>Image description and details here.</p>
<button onclick="window.location.href='imageGallery/more-info.html';">More Information</button>
</div>
<script src="imageGallery/script.js"></script>
</body>
</html>
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Image Gallery</title>
<link rel="stylesheet" href="imageGallery/style.css">
</head>
<body>
<div id="gallery">
<?php include 'imageGallery/load_images.php'; ?>
</div>
<div id="popup" style="display:none;" onclick="closePopup()"> <img id="popup-img" src="" alt="Large image" onclick="closePopup()">
<p>Image description and details here.</p>
<button onclick="window.location.href='imageGallery/more-info.html';">More Information</button>
</div>
<script src="imageGallery/script.js"></script>
</body>
</html>
---------------
Code load_images.php
---------------
Code (php)
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
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
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<?php
$thumbnailDir = 'thumbnails';
$fullSizeDir = 'fullsize';
$images = array_diff(scandir($thumbnailDir), array('..', '.'));
usort($images, function($a, $b) {
return strnatcmp($b, $a);
});
echo '<div id="popup">';
echo '<img id="popup-img" src="" alt="Full size image" onclick="closePopup(event)">';
echo '<div class="overlay-text">';
echo '<p>Image details here</p>'; // Small text on the left
echo '<button class="close-button">Close</button>';
echo '<button onclick="moreInfo()">More Info</button>';
echo '</div>';
echo '</div>';
foreach ($images as $image) {
$fullImagePath = $fullSizeDir . '/' . $image;
$thumbnailPath = $thumbnailDir . '/' . $image;
echo '<div class="thumbnail">';
echo '<img src="' . $thumbnailPath . '" alt="Thumbnail of ' . $image . '" onclick="openPopup(\'' . $fullImagePath . '\')" />';
echo '</div>';
}
?>
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<?php
$thumbnailDir = 'thumbnails';
$fullSizeDir = 'fullsize';
$images = array_diff(scandir($thumbnailDir), array('..', '.'));
usort($images, function($a, $b) {
return strnatcmp($b, $a);
});
echo '<div id="popup">';
echo '<img id="popup-img" src="" alt="Full size image" onclick="closePopup(event)">';
echo '<div class="overlay-text">';
echo '<p>Image details here</p>'; // Small text on the left
echo '<button class="close-button">Close</button>';
echo '<button onclick="moreInfo()">More Info</button>';
echo '</div>';
echo '</div>';
foreach ($images as $image) {
$fullImagePath = $fullSizeDir . '/' . $image;
$thumbnailPath = $thumbnailDir . '/' . $image;
echo '<div class="thumbnail">';
echo '<img src="' . $thumbnailPath . '" alt="Thumbnail of ' . $image . '" onclick="openPopup(\'' . $fullImagePath . '\')" />';
echo '</div>';
}
?>
Gewijzigd op 15/05/2024 17:05:06 door - Ariën -
Rechtsklik eens op een 'dood' plaatje. Dan kan je de URL ziet die geprobeerd wordt te openen.
Ja daar probeert hij dit te openen:
<img src="thumbnails/image2.jpg" alt="Thumbnail of image2.jpg" onclick="openPopup('fullsize/image2.jpg')">
De source moet: imageGallery/thumbnails/image2.jpg zijn maar waar ik ook 'imageGallery/' voor zet, het werkt niet. Bijvoorbeeld bij fullimagePath
<img src="thumbnails/image2.jpg" alt="Thumbnail of image2.jpg" onclick="openPopup('fullsize/image2.jpg')">
De source moet: imageGallery/thumbnails/image2.jpg zijn maar waar ik ook 'imageGallery/' voor zet, het werkt niet. Bijvoorbeeld bij fullimagePath
Wat dacht je van $thumbnailDir ?
$fullImagePath = $fullSizeDir . '/' . $image;
$thumbnailPath = $thumbnailDir . '/' . $image;
Deze beide al eens in dit veranderd, maar lost niets op helaas :-(
$fullImagePath = $fullSizeDir . '/imageGallery' . $image;
$thumbnailPath = $thumbnailDir . '/imageGallery' . $image;
Toevoeging op 15/05/2024 17:52:18:
ook in het volledige pad: /imageGallery/thumbnails werkt niet
Toevoeging op 15/05/2024 18:04:14:
Ah, als ik die aanpas zet hij het op de verkeerde plek.
https://www.markpaulussen.com/test/thumbnails/imageGallery/image3.jpg
Toevoeging op 15/05/2024 18:08:55:
oke, nu heb ik op line 9: $thumbnailDir = 'thumbnails';
veranderd in: $thumbnailDir = 'imageGallery/thumbnails';
maar dan krijg ik weer een error.
Toevoeging op 15/05/2024 18:14:11:
Hij moet bij line 28!
echo '<img src="imageGallery/' . $thumbnailP.... etc.
haha, jeetje. Nu de rest nog aan de praat krijgen. Bedankt Ariën voor het duwtje :-)
$thumbnailPath = $thumbnailDir . '/' . $image;
Deze beide al eens in dit veranderd, maar lost niets op helaas :-(
$fullImagePath = $fullSizeDir . '/imageGallery' . $image;
$thumbnailPath = $thumbnailDir . '/imageGallery' . $image;
Toevoeging op 15/05/2024 17:52:18:
ook in het volledige pad: /imageGallery/thumbnails werkt niet
Toevoeging op 15/05/2024 18:04:14:
Ah, als ik die aanpas zet hij het op de verkeerde plek.
https://www.markpaulussen.com/test/thumbnails/imageGallery/image3.jpg
Toevoeging op 15/05/2024 18:08:55:
oke, nu heb ik op line 9: $thumbnailDir = 'thumbnails';
veranderd in: $thumbnailDir = 'imageGallery/thumbnails';
maar dan krijg ik weer een error.
Toevoeging op 15/05/2024 18:14:11:
Hij moet bij line 28!
echo '<img src="imageGallery/' . $thumbnailP.... etc.
haha, jeetje. Nu de rest nog aan de praat krijgen. Bedankt Ariën voor het duwtje :-)
Mooi dat je hem hebt! :-)




