how do you echo multiple images that have the same name as part of the file name in php? -


i trying figure out how echo images in directory contain same name part of file-name. have files being uploaded web-server. when uploaded files renamed 108_2.jpg, 108_3.jpg... etc.

i echo images contain 108 file-name. have far:

<img src="../uploads/<?php echo $_session['propertyid'].'.jpg'; ?>" alt="photo" width="100" height="100" border="0" /> 

the $_session['propertyid'] "108" part of file name.

this way should make trick. careful path, might not same client , server…

<?php $path = "../uploads"; foreach (glob("$path/{$_session['propertyid']}*") $filename): ?>     <img src="<?php echo $path ?>/<?php echo $filename ?>" alt="photo" width="100" height="100" border="0" /> <?php endforeach ?> 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -