My company uses an optical targeting sensor that outputs resultant images as nested .bmp/.svg files. Both files have the exact same file name just different extensions (eg: Image0000.bmp and Image0000.svg) and are written via FTP to an apache webserver.
What I am trying to do is display a ‘gallery’ of the *.bmp files which are sorted newest-first. Then, On-Click, open a new page/tab to display the *.svg file bearing the same name…
Here’s what I’m using to generate the ‘gallery’:
— Code Start —
<?php function newest($a, $b) { return (filemtime($a) > filemtime($b)) ? -1 : 1; } $filepath = 'resultant_images/*'; $bmp_image = glob($filepath . "*.{bmp}", GLOB_BRACE); uasort($bmp_image, "newest"); foreach($bmp_image as $bmp_target) { echo '' . basename($bmp_target) . ''; } ?>
— Code End —
How do I re-direct to a link with the same file name but using a different extension?