Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP array without file extension - vimeo video
    primarykey
    data
    text
    <p>I finally managed to get the PHP script below to work...but then I found that I actually can't call vimeo video links because they do not have a file extension eg: <a href="http://vimeo.com/12345678" rel="nofollow">http://vimeo.com/12345678</a></p> <p>The script I'm using loads a slideshow if the file extension is an image file, if it's a flash file it loads the swf, and my idea was to have a vimeo iframe load if the file extension was for example .mov. All of the filenames are in the work.txt file.</p> <p>I am so confused about what to do! Does anyone have any ideas of what I could add so that this script can load vimeo videos?</p> <pre><code> &lt;?php $photos=file("work.txt"); $img = array('jpg', 'png', 'gif'); $vid = array('mp4', 'mov', 'mpg', 'flv'); $flash = array('swf'); foreach($photos as $image){ $item=explode("|",$image); if($item[0]==$fields[0]){ $photo=trim($item[1]); $ext = explode(".", $photo); if(in_array($ext[1], $img)) { echo "&lt;div id='slider-wrapper'&gt;&lt;div id='slider' class='nivoSlider'&gt;&lt;img src='images/work/$photo' alt='' /&gt;&lt;/div&gt;&lt;/div&gt;"; } elseif(in_array($ext[1], $vid)) { echo "&lt;iframe src='http://player.vimeo.com/video/$photo' width='900' height='500' frameborder='0' webkitAllowFullScreen allowFullScreen&gt;&lt;/iframe&gt;"; } elseif(in_array($ext[1], $flash)) { echo "&lt;object id='myId' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='900' height='500'&gt;&lt;param name='movie' value='$photo' /&gt; &lt;!--[if !IE]&gt;--&gt; &lt;object type='application/x-shockwave-flash' data='$photo' width='900' height='500'&gt; &lt;!--&lt;![endif]--&gt; &lt;div&gt; &lt;h1&gt;Alternative content&lt;/h1&gt; &lt;p&gt;&lt;a href='http://www.adobe.com/go/getflashplayer'&gt;&lt;img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;!--[if !IE]&gt;--&gt; &lt;/object&gt; &lt;!--&lt;![endif]--&gt; &lt;/object&gt;"; } } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload