Your Cart

Example of PHP5 building JSON data source

These forums are now closed to new replies / tickets.

Please open a support ticket from our new Support page.

Front Page Forums This and that Example of PHP5 building JSON data source

  • gravatar
    Verve X3, LLC
    October 24, 2012 at 5:50 am

    I am using DirectorPHP to dynamically pull data from Slideshow
    Pro Director. It works fine and the Azur template is quite nice.
    You can see it in action at www DOT photosensate DOT com.

    I would like to increase performance, and while I am using
    cache, I believe letting the server provide the thumbs would help
    alot.

    I am struggling with the sparse documentation about how to pass
    thumbs as well as large and original image urls, and with how to
    provide additional data (in my case, the EXIF data). I have read
    the documentation and believe JSON would be the best approach. But
    I am struggling with how to generate the JSON in php5 script.
    Here’s what I currently use:

    if($posttype == "[albumID=") { 
        $apikey='myapikey';
        $apipath='myapipath';
        require_once(__ROOT__ . "galleria/classes/DirectorPHP.php");
        $director = new Director($apikey, $apipath);
        $director->cache->set('cache'.$albumID,'+10 days');
        // You may need this depending on what you are doing with galleria
        $director->format->add(array('name' => 'thumb', 'width' => '100', 'height' => '100', 'crop' => 1, 'quality' => 75, 'sharpening' => 1));
        //These are the parameters of the image that will be used when galleria is displaying a single album
        $director->format->add(array('name' => 'large', 'width' => '720', 'height' => '572', 'crop' => 0, 'quality' => 100, 'sharpening' => 1));
        $album = $director->album->get($albumID);
        $contents = $album->contents[0];
        foreach ($contents as $image) {
            $settings="Settings: Exposure-".$image->exif->exposure." ISO-".$image->exif->iso." Aperture-".$image->exif->aperture." Focal Length-".$image->exif->focal_length." ".$image->exif->flash_simple;
            $device="Camera: ".$image->exif->model;
            echo '<img src="'.$image->large->url.'"/><br />';
        }
    }
    // Load the Azur theme
    Galleria.loadTheme('wp-content/themes/responsive-child-theme/galleria/themes/azur/galleria.azur.min.js');
    // Initialize Galleria
    
    Galleria.run('#galleria', {
        height: 572,
        showImagenav: true,
        transition: 'fade',
        imageCrop: false,
        autoplay: 4000, // will move forward every 4 seconds
        carousel: true,
        responsive: true,
        showImagenav: true,
        pauseOnInteraction: true,
        showInfo: true,
        //dataSort: 'random',
        //transition: 'pulse',
        //transition: 'flash',
        //transition: 'slide',
        //transition: 'fadeslide',
        transition: 'fade',
        lightbox: true, 
        trueFullscreen: false,
        });
    </script>
    

    I am quite willing to work though my own code i.e. not asking
    you to debug anything. But the examples provided for JSON are
    suggestive only. Might you edit the code above a bit to demonstrate
    how to take the data passed in from DirectorPHP and utilize it with
    JSON and pass it to Galleria?

    Any help would be greatly appreciated.

    I really like the product but think more complete sets of
    example code would be very helpful for some of us.

    Best regards,


    gravatar
    Stephen Magladry
    November 12, 2012 at 6:38 am

    Verve 3,

    I don’t know if you found a php solution. After posting
    something in the This and That forum on the galleria help board, i
    noticed your post. The Reference to php caught my eye. After
    looking at it, I noticed you had a question about php.

    You are in luck! You see, I just posted php code to create a
    JSON array for using with galleria. It is in the This and That
    forum, dated 11/11/12. I hope you find it helpful.


    gravatar
    Sarah Phipps
    September 15, 2014 at 5:51 am

    I also use directorPHP and have struggled with this for a long
    time and found a solution. I hope this helps someone else who has
    this issue.
    I define the sizes:
    $director->format->add(array(‘name’ => ‘thumb’, ‘width’
    => ’90’, ‘height’ => ’90’, ‘crop’ => 0, ‘quality’ =>
    75, ‘sharpening’ => 1));
    $director->format->add(array(‘name’ => ‘image’, ‘width’
    => ‘800’, ‘height’ => ‘600’, ‘crop’ => 0, ‘quality’ =>
    80, ‘sharpening’ => 0));
    $director->format->add(array(‘name’ => ‘big’, ‘width’
    => ‘1920’, ‘height’ => ‘1080’, ‘crop’ => 0, ‘quality’
    => 90, ‘sharpening’ => 0));

    and added this to the container:


    gravatar
    ndaaqkxg
    September 26, 2014 at 9:23 am

    interest there is in how she’s doing and her story,” said
    Kelly.Casey Anthony, center, walks out of the Orange County Jail
    with her attorney Jose Baez, left, during her release in Orlando,
    Fla., early Sunday, July 17, 2011.AP Photo/Red Huber(/WKMG)ORLANDO,
    Fla. – The bounty hunter who temporarily
    http://www.airmax90outlet.org

    Friday” was taken off YouTube by Rebecca Black’s lawyers. The
    YouTube page reads, “This video is no longer available due to a
    copyright claim by Rebecca Black.”The annoyingly popular video – in
    a director’s cut edition – resurfaced on a Rebecca Black
    VEVO-branded page (also on YouTube) only to be
    http://www.airmax90outlet.org

    of Israel at the U.S. Open tennis tournament in New York, Sunday,
    Sept. 5, 2010. (AP Photo/Kathy Willens)NEW YORK () Tennis star
    Venus Williams has done it again!The30-year-old athlete, whose
    sartorial choices sometimes overshadow her tennis prowess, had
    tongues wagging at the U.S. Open this weekend
    http://www.airmax90outlet.org

    The first-stage booster will be recovered from the ocean for
    analysis.Constellation Program (NASA)NASA Home PageEdward Burns at
    a screening of “Nice Guy Johnny” on Oct. 19, 2010, in New
    York.Getty() Edward Burns has become synonymous with Tribeca and
    the Tribeca Film Festival in the last decade. His
    http://www.airmax90outlet.org


Galleria uses cookies to provide necessary site functionality. By using our website, you agree to our Privacy Policy. I understand