Jump to content

Colink

New Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Colink

  • Rank
    Newbie
  1. Thanks for your suggestion @ginerjm I will park this issue for now and come back to it when I have other parts of the project completed. Thanks to all who replied. ColinK
  2. First of all a thank you to all those who replied, the experience is much more friendly than the usual stack overflow attitude - "If you have not 90% solved your issue and if you do not have expertise "DON'T ASK"" I am still not much further on. eg I cannot see how this code (from the link @barand gave) can be modified to work with his suggestion of "$images = glob($dir."/thisword*.*");" which @barand gave or how to include code for an array as suggested by @dalecosp and make it all work for my AMP carousel. for each (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n"; ===== I really am just a copy and paste coder so need something closer to my needs to edit. I do understand the philosophy of learn vs being given the answer but the "clues" have not been sufficient for my skills. If further guidance is not available, thanks again for the answers thus far. ColinK
  3. Thanks for your prompt response. Unfortunately my "copy and paste" coding skills were not good enough for this. All images in the folder still display not just those with file names that start with "thisword" This is what I tried (old $dir line commented out, modified version below in bold) <amp-carousel class="xs-12 bannerimg4 " width="16" height="9" layout="responsive" type="slides" controls loop autoplay delay="3000"> <?php // OLD directory code $dir = "images/image4"; $images´╗┐ = glob($dir."/images/image4/thisword*.*"); $handle = opendir(dirname(realpath(__FILE__)).'/images/image4'); while($file = readdir($handle)){ if($file !== '.' && $file !== '..'){ // echo '<img src="images/banner-1040/'.$file.'" border="0" />'; echo '<amp-img src="images/image4/'.$file.'" layout="responsive" class="cover" width="16" height="9" alt="images/banner-1040/'.$file.'"></amp-img>'; } } ?> </amp-carousel> I did try adding thisword*.* to the handle line, but this hides all images Any further help would be appreciated. Colin K
  4. Hi Firstly I am a "copy and paste" coder, not a real coder. The following code is on an AMP HTML page. It displays all images from a specific folder in an AMP carousel. I know the AMP part is not relevant but I copy all of the code (below) from his section of the page to show context. What currently happens: All images in folder "images/image4" are displayed in the Carousel What I would like to happen: Return all images WHERE file name starts with "thisword" eg thisword1.jpg thisword2.jpg Ignore thisotherword1.jpg Any suggestions would be appreciated. ColinK Existing code <amp-carousel class="xs-12 bannerimg4 " width="16" height="9" layout="responsive" type="slides" controls loop autoplay delay="3000"> <?php $dir = "images/image4"; $handle = opendir(dirname(realpath(__FILE__)).'/images/image4'); while($file = readdir($handle)){ if($file !== '.' && $file !== '..'){ // echo '<img src="images/banner-1040/'.$file.'" border="0" />'; echo '<amp-img src="images/image4/'.$file.'" layout="responsive" class="cover" width="16" height="9" alt="images/banner-1040/'.$file.'"></amp-img>'; } } ?> </amp-carousel>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.