G3 embedding - A RESTful gallery - My trials, opinions and results
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
Yesterday I set out to bring another example of "External G3" usage, this time using the REST interface. Issues:
It wasn't all frustrations though, I loved several aspect. Anyways, here is my result: http://www.flashyourweb.com/gallery2/embed_samples/g3_rest.php You can get the code here. Comments? Recap to all the external G3 examples:
And we now have a Wordpress plugin implementing the RESTful functionality. -s |
|
jnash
![]()
Joined: 2004-08-02
Posts: 814 |
![]() |
All your points seem legit to me. Your results are fantastic! |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
The code for my example is now available in the original post. -s |
|
heydroid
Joined: 2003-09-29
Posts: 48 |
![]() |
I was playing around with your REST code and found a few bugs. 1. Videos only seem to play if you press the back button after you click on them. (only happens on 1 video http://awelker.com/rest/#item/3738 with the title of 4-30-2011. It is on the first page) 2. Only works if you have show full size enabled. 3. Did not work with my rest API key, had to turn guest mode on. Thanks for your work! |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
Thanks for trying my code and for the feedback, this will help me see what others are seeing. Quote:
1. Videos only seem to play if you press the back button after you click on them. The <video /> needs a parent DOM element to function properly. Please create at least the basic page structure ie. <!doctype html> <html> <head> <script src="code/modernizr.js"></script> <script src="code/respond.min.js"></script> <link href="code/style.css" type="text/css" rel="stylesheet" /> <!--[if gte IE 9]> <style type="text/css"> .gradient { filter: none; } </style> <![endif]--> <link href="code/ajaxGallery.css" type="text/css" rel="stylesheet" /> </head> <body> <div class="ajax-title"> <h2>Javascript required to view this content.</h2> </div> <ul id="breadcrumbs"></ul> <ul id="ajax-gallery"></ul> <div id="ajax-description"> <p></p> </div> <ul id="pager"></ul> <!-- javascript after content --> <script src="code/klass.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="code/code.photoswipe.jquery-3.0.4.min.js"></script> <script src="code/jquery.ba-hashchange.min.js"></script> <script src="code/jquery.colorbox-min.js"></script> <script src="code/media.template.js"></script> <script src="code/g3.rest.js"></script> </body> </html> Quote:
Only works if you have show full size enabled. Currently I'm using the fullsize when a widescreen is detected, and resize for smaller screens < 1000px Quote:
Did not work with my rest API key, had to turn guest mode on. Refer to my 1st issue listed above I also noticed yoursite needs a crossdomain.xml which flowplayer was looking for. -s |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
@heydroid Quote:
Did not work with my rest API key, had to turn guest mode on.
rest = { url: 'http://www.yoursite.com/gallery3/rest', initial: 1, max_items_per_page: 20, key: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx' }; ****Scratch that**** Which to adds to my point in the first post - a total fail on the rest interface. -s |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
This is now a jQuery plugin which makes it far easier to use. <script> $(document).ready(function(){ $('#gallery').g3rest(); }); </script>
-s |
|
rl98256
Joined: 2012-07-15
Posts: 1 |
![]() |
suprsidr, cool stuff you developed. Currently it works with allow_guest_access only, this leaves only the authenticated access question open. Appreceate your effort and contribution for the G3 community. |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
rl98256 wrote:
Do you think there will be an option available soon to use the rest api key for authenticated access? suprsidr wrote:
After I turned allow_guest_access off again it did not work from my desktop. not until that is fixed rl98256 wrote:
It took a while and required some forum reading, but in the end the thread where you supported dave111111 answered all my question. Sorry, I'm horrible at documentation which is why I usually refer users to these forums where we openly discuss issues/solutions. -s |
|
gabstero
![]()
Joined: 2010-01-06
Posts: 51 |
![]() |
this is fantastik! Question - how can you embed only a certain album from a gallery? thanks |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
the options available are: url: url to your G3 rest interface - required code: url to the directory containing the included code directory - I have changed this in my working copy to the url to the code directory - simpler initial: 1, // the initial album to start with - default 1 max_items_per_page: 20, // the maximum items per page - default 20 key: '' // rest key - advanced features not working ignore for now so you can start like this: $('#gallery').g3rest({ url: 'http://yoursite.com/gallery3/rest', code: 'http://yoursite.com/gallery3/', initial: 17, max_items_per_page: 10 }); -s |
|
gabstero
![]()
Joined: 2010-01-06
Posts: 51 |
![]() |
very nice - THANKS! is there a way to discover the initial number for a certain album on gallery? I have many albums thanks, |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
if you view the source of your album's page you can see the RSS feed: -s |
|
gabstero
![]()
Joined: 2010-01-06
Posts: 51 |
![]() |
that's great - thanks! Now I have trouble using the code in a dynamically product page in my zen cart online store system. I added all the javascripts in the header, etc., but the gallery album is displayed sort of odd: http://www.gabkits.com/amp-cabinets/overtone/overtone-head However, if I have a standalone page linking to the same resources, it works: http://www.gabkits.com/minimal_page_structure.html do you have an idea what I might be doing wrong? thanks! |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
is that the correct url to ajaxGallery.css -s |
|
gabstero
![]()
Joined: 2010-01-06
Posts: 51 |
![]() |
yep - that's the right path to it. Also I eliminated your syle.css from the header. And I pointed the " code:" to point to http://www.gabtone.com/gallery/ where the "code" folder resides. thanks for looking at this. gabstero |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
a little lesson in relative urls: But adding the leading / forces the relative url from the root of the site -s |
|
gabstero
![]()
Joined: 2010-01-06
Posts: 51 |
![]() |
bingo!! the leading / solved everything!!! MANY THANKS!! This mod rules! cheers! |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
I have created a Wordpress plugin to display your G3 in WP -s |
|
luglug
Joined: 2005-10-09
Posts: 8 |
![]() |
THANK YOU SO MUCH suprsidr Your restful implementation kicks ass! One quick question, is there a way to get the album and photo names to just appear rather than requiring a mouseover? I poked around the css but couldn't find anything that changed that behaviour. |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
the pop-title is literally appended to the element on mouseover so there is nothing to show until then. One of the tricks with this responsive grid layout is that every element has to be the same height and that height is figured out as the images load. so no, not easily. -s |
|
Murphy_ia
Joined: 2013-06-23
Posts: 2 |
![]() |
I am trying to implement this on my webpage, but keep getting the message that javascript required to run this content. Have tried several different placements of the code and different versions of the link to the code but still keep getting this, when I try to visit other sites with this implemented everything works fine. If anyone has any suggestions I would be very happy. Thanks |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
javascript syntax error. -s |
|
Murphy_ia
Joined: 2013-06-23
Posts: 2 |
![]() |
Perfect, thank you |
|
JaronRH
Joined: 2010-07-28
Posts: 23 |
![]() |
Glad to see I wasn't the only one stumbling my way through the Gallery3 RESTful API! I too was very curious why the members came back as URL's instead of id's. I ended up using regex to get the id's that I needed when the API only gave me URL's so it worked out in the end. Also, the lack of complete documentation made it much more difficult then it had to be (I'm looking at you, tags!). I ended up not really integrating Gallery3 into my existing site but rather making my own client front-end for Gallery3. This let me display the images in nicer interface without all of the management overhead that only I use in Gallery3. Also, I can give my users their own login information so that they can download their images after logging in (I updated User Homes module to include a REST interface so I can assign users their own album "homes" -- http://galleryproject.org/node/95629#comment-405447). The biggest improvement though was that I can selectively cache my RESTful request/response to improve performance and I also use dynamic loading of images instead of paging. I'm still working on it but you can check out the results here: In the end though, I'm very happy with how everything turned out. |
|
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
JaronRH, I did notice even on the Galereya demo site as well as yours that on mouseover the thumbs 'blink' black. Not sure why but it is the only thing I can see that I did not like. Dave |
|
azzahra
Joined: 2013-09-13
Posts: 1 |
![]() |
Hey everyone, At beginning I will say that I'm not the best in websites building. Could someone suggest something I should do? |
|
nickelaj
Joined: 2013-09-19
Posts: 8 |
![]() |
azzahra wrote:
Hey everyone, I am reading and trying to embed gallery3 to my website but i think i am doing something wrong or less as azzahra. Is there any documentation or installation guide for this ? thanks |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
http://www.flashyourweb.com/gallery2/embed_samples/g3_rest.php <- click the show/hide code button or see the examples given in the download -s |
|
nickelaj
Joined: 2013-09-19
Posts: 8 |
![]() |
suprsidr wrote:
http://www.flashyourweb.com/gallery2/embed_samples/g3_rest.php <- click the show/hide code button i searched and read everything in those links, but i couldnt make it work. for example i am filling my websites in the below links i am getting 404 error url: 'http://www.flashyourweb.com/gallery3/rest', |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
you may have to use http://www.mysite/subsite/galeri/index.php/rest if you don't have rewrite active -s |
|
nickelaj
Joined: 2013-09-19
Posts: 8 |
![]() |
suprsidr wrote:
you may have to use http://www.mysite/subsite/galeri/index.php/rest if you don't have rewrite active exactly you are wonderfull. now i did something. if you dont get mad thanks a lot |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
you'll have to send me a link -s |
|
nickelaj
Joined: 2013-09-19
Posts: 8 |
![]() |
suprsidr wrote:
you'll have to send me a link one gallery can work, when adding second the error occurs. a lot of regards and thanks for your interest. |
|
nickelaj
Joined: 2013-09-19
Posts: 8 |
![]() |
nickelaj wrote:
i sent the all links includes embedded site too. |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
1st change to an older version of jquery: the next error looks like an album thumbnail is missing. -s |
|
nickelaj
Joined: 2013-09-19
Posts: 8 |
![]() |
suprsidr wrote:
1st change to an older version of jquery: i am still working for it, as you saw i uploaded your minimal_page_structure.html and edited it for my gallery. |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
there is nothing wrong with my script. -s |
|
nickelaj
Joined: 2013-09-19
Posts: 8 |
![]() |
suprsidr wrote:
there is nothing wrong with my script. no no you understood me wrong. deleted all folder, database and installed again. It is ok now. Thanks again for code and your interest. |
|
nickelaj
Joined: 2013-09-19
Posts: 8 |
![]() |
hi again, thanks |
|
aquarium
Joined: 2013-10-02
Posts: 1 |
![]() |
Used it for my gallery and worked integration without problem. Thanks for your work. Only problem for me is getting first picture size. Is there any way to arrange it ?? |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
try arranging them in gallery. -s |
|