Welcome Guest, Not a member yet? Register   Sign In
Simple Image gallery Library
#1

[eluser]Jelmer[/eluser]
I searched both the forum and the Wiki and couldn't really find a simple image gallery so I wrote one. It's in no way intended for direct use, and I probably won't develop it for general use any further but it might be a step-stone for anyone trying to write his/her own. I'll be writing more but it'll mostly be code usable only for the script I started it for, but I will add anything of general use.

For full credit: I based the library on an image gallery tutorial at: http://www.phptoys.com/e107_plugins/cont...content.54

Here it is, feel free to use it without credit:
UPDATE 21 September 2008
Look at the post #10 for the improved code.
UPDATE 30 oktober 2008
Bugfix in the aforementioned post for bug that ignored uppercase file-extentions.

It outputs an array with 2 arrays: one with the images and another with directories which I displayed within a controler as follows:

Code:
if (count($images['dirs']) != 0) {
    foreach($images['dirs'] as $dir) {
        $dir_display .= '<li><a href="controler/dir_method/'.base64_encode($dir['path'].$dir['dir']).'.htm">'.$dir['dir'].'</a></li>';
    }
    $data['content'] .= '<h3>Directories</h3><ul>'.$dir_display.'</ul>';
}

foreach($images['images'] as $image) {
    $images_display .= '<li><a >image_gallery->getNormalImage($image['path'].$image['thumb']).'.htm">
    <img src="'.$image['path'].$image['thumb'].'" alt="'.$image['image'].'">image_gallery->thmb_width.'px; max-height: '.$this->image_gallery->thmb_heigth.'px;" /><br />'.$image['image'].'</a></li>';
}
$data['content'] .= '<h3>Images</h3><ul>'.$images_display.'</ul>';

And they should link to a image gallery controler with a dir viewing method and an image viewing method. Both of which I don't provide, as mentioned a couple of times below: this library is meant to help you write your own, not as a plug & play image gallery!
#2

[eluser]Jelmer[/eluser]
I don't get it, pieces of the code are removed by the forum? I've tried quoting it instead of within code-tags but that just causes other parts of the code to disappear.
#3

[eluser]jasont[/eluser]
try posting it in the wiki?
#4

[eluser]Jelmer[/eluser]
I'll attach it as a file in a bit, I've changed a couple of things and will have to change a couple of other things to make it generaly usable. Also the part of the code missing isn't vital so you could make it work without the missing part already.
#5

[eluser]lizaaard[/eluser]
do you've finished this lib?
#6

[eluser]Colin Williams[/eluser]
The only problem I can see with the Library so far is the coding style. It's a bit erratic. Take a look at EllisLab's development guidelines at http://expressionengine.com/docs/develop...index.html

To be clear, this is not a knock on the functionality or solidarity of your contribution; it is just a suggestion to keep contributions consistent with the framework.
#7

[eluser]wiredesignz[/eluser]
@Jelmer, This is an excellent contribution, I'm sure others will benefit from it. Wink

@Colin, I'm sure you can alter the coding style to suit yourself when you use this library.
#8

[eluser]Jelmer[/eluser]
@lizaaard: if you mean by finished the version with the full code, I went on vacation for 2 weeks after posting and thought then I'd come round to removing my specific code and replace it with general usable stuff but I didn't. If you mean creating a front-end, it was never my intention to do so. As I mentioned in my introduction I shared it as a stepping stone not as a full fledged image gallery. That being said, I'll be adding some code in the next couple of days for pagination and for displaying template after that's done I'll share the updated library in which I hope to have eliminated all my system-specific code.

@Colin Williams: Again, it's meant as a stepping stone, for people to write to their own image gallery without having to do the groundwork. Also since it's a rewrite of the tutorial I mentioned it's a bit of a mix of my own and the tutorial's style. I think it's usable and understandable for others and I just don't have the time to rewrite it in a different style. But thanks for the suggestion, I saw a couple of helpfull tips in there I hadn't thought about before.

@wiredesignz: thanks for the compliment.
#9

[eluser]dameryworld[/eluser]
Did anybody get this to work?
#10

[eluser]lizaaard[/eluser]
no i dont.. yet...

i'm looking for a good image library.. and i'll try to add into CI.. but i'm kind of newbie in PHP/CI...

i love this library (EasyGallery) but i need some pagination... cause i'll handle a lot of images...




Theme © iAndrew 2016 - Forum software by © MyBB