1) Script Title: PHP Photo Album script
2) Script URL (on DD): http://dynamicdrive.com/dynamicindex...photoalbum.htm
3) Describe problem: I have been using version 1 of this script for many years. It uses a little file called getpics.php which is pretty close to the getalbumpics.php of version 2. Both of them use the deprecated command "eregi"
Running under php 5.6, it works no problem, but I am trying to plan ahead because eregi will be totally removed for php 7. I have tried to use the php manual to replace eregi with preg_match but it doesn't seem to work:Code:<?php Header("content-type: application/x-javascript"); function returnimages($dirname=".") { $pattern="\.(jpg|jpeg|png|gif|bmp)$"; $files = array(); $curimage=0; if($handle = opendir($dirname)) { while(false !== ($file = readdir($handle))){ if(eregi($pattern, $file)){ $filedate=date ("M d, Y H:i:s", filemtime($file)); echo 'galleryarray[' . $curimage .']=["' . $file . '", "'.$filedate.'"];' . "\n"; $curimage++; } } closedir($handle); } return($files); } echo "var galleryarray=new Array();" . "\n"; returnimages(); ?>I do not know JavaScript. Does Dynamic Drive have an updated version of this script for php 7? Thanks very much. I am profoundly grateful to you DD guys because, if it hadn't been for your coding assistance and DD scripts, I could never have built websites. Sincerely, thank you.Code:if(preg_match('/$pattern/i', $file)){



Reply With Quote

Bookmarks