Hi,
I would like a small mini gallery on the index page, like imgur. I first tried with a simple RecursiveDirectoryIterator although I don't get the viewer page this way. I realized I can utilize the FileList class and easily get image_url and image_viewer. Is this a json object? What is the best way to access this?
I tried to:
$filelist = new Filelist('all','desc', 20);
print_r($filelist);
::returns array data::
Problem is when I want to loop through it and build a image grid, the dirty hacks are because I want to use relative dir.
* Why is this anyway? I think it is odd the domain is in the database for each image vs set a $config['domain'] and join/implode where needed? (ugh where is a php ORM?!)
foreach($filelist as $key) {
$path = explode("com", $key['image_url']); // dirty hack
$thumb = explode("com", $key['image_thumb_url']); // another dirty hack
?><a href="<? echo $path[1]; ?>"><img src="<? echo $thumb[1];?>"> </a><?
}
This works but there are empty imgs because They whole array beings with:
[error] =>
[ok] =>
I suppose I would need a for loop and start to iterate from index to length.
OR
Is there any better way to get this data or am I on the right track?
Is there anyway to utilize the admin gallery? Would be nice if that could be re factored to be more generic since overall it should be json and could use all the dozens of jquery galleries around.
Maybe that's just it! How could I json this? Just encode $filelist?
Thank you,
Bryan
I would like a small mini gallery on the index page, like imgur. I first tried with a simple RecursiveDirectoryIterator although I don't get the viewer page this way. I realized I can utilize the FileList class and easily get image_url and image_viewer. Is this a json object? What is the best way to access this?
I tried to:
$filelist = new Filelist('all','desc', 20);
print_r($filelist);
::returns array data::
Problem is when I want to loop through it and build a image grid, the dirty hacks are because I want to use relative dir.
* Why is this anyway? I think it is odd the domain is in the database for each image vs set a $config['domain'] and join/implode where needed? (ugh where is a php ORM?!)
foreach($filelist as $key) {
$path = explode("com", $key['image_url']); // dirty hack
$thumb = explode("com", $key['image_thumb_url']); // another dirty hack
?><a href="<? echo $path[1]; ?>"><img src="<? echo $thumb[1];?>"> </a><?
}
This works but there are empty imgs because They whole array beings with:
[error] =>
[ok] =>
I suppose I would need a for loop and start to iterate from index to length.
OR
Is there any better way to get this data or am I on the right track?
Is there anyway to utilize the admin gallery? Would be nice if that could be re factored to be more generic since overall it should be json and could use all the dozens of jquery galleries around.
Maybe that's just it! How could I json this? Just encode $filelist?
Thank you,
Bryan