Jump to content

tiltviewer php


godyn

Recommended Posts

Hello folks,

 

After some experimenting I finally got the php working for tiltviewer flash gallery to load the pictures via php instad via xml file.

 

Only I have some other things I want solved.

 

I would like that the script only shows pictures that begin with

photo' or 'picture' and between sizes.(kb)

 

example:

 

IF afbeelding

begint met 'picture' or 'photo'

AND afbeelding < 200kb AND >20Kb

THEN 'toon de foto' (dus scriptje uitvoeren'

ELSE niets (of niet tonen)

 

this is the script, I would be in heaven if s.b. would help me out with this.

 

I also would like the images to be random (I think now he follow the directory (from the array?)

 

<?php
function GetDirArray($folder) {
   $handle=opendir($folder);
   while ($file=readdir($handle)) {
      if ($file!="." && $file!="..") {
         $ret[count($ret)]=$file;
      }
   }
   closedir($handle);
   sort($ret);
   return $ret;
}
$gallery=GetDirArray('../media/uploads');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<tiltviewergallery>';
echo '<photos>';
for ($i=0; $i<sizeof($gallery); $i++)
{
   echo '<photo imageurl="../media/uploads/'.$gallery[$i].'"><title></title><description></description></photo>';
}
echo '</photos>';
echo '</tiltviewergallery>';
?> 

Link to comment
https://forums.phpfreaks.com/topic/168790-tiltviewer-php/
Share on other sites

Try this?

 

for ($i=0; $i<sizeof($gallery); $i++)
{
   $img_size = filesize("../media/uploads/".$gallery[$i]);

   if((substr($gallery[$i], 0, 7) == "picture" || substr($gallery[$i], 0, 5) == "photo") && ($img_size >= 20480 && $img_size < 204800))
   {
      echo '<photo imageurl="../media/uploads/'.$gallery[$i].'"><title></title><description></description></photo>';
   }
}

Link to comment
https://forums.phpfreaks.com/topic/168790-tiltviewer-php/#findComment-890645
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.