• Resolved warpig

    This is a little hack to enable you to display Random Photos from your Gallery installation
    Open up your block-random.php file (which should be included with the Gallery dist. If not, search the Gallery Forums for a copy, or download from this URI), in block-random.php add;
    $GALLERY_BASEDIR = "/abolute/path/to/your/gallery/";
    Including the back slash. Be sure to add this just before the Hack Prevention code.
    Next, modify your WordPress template to include the default PHP output buffering as;
    < ?php
    /* begin output buffering */
    ob_start();
    /* Don't remove this line. */
    require('./wp-blog-header.php');
    ?>

    you can see, I have ensured that ; is the first function called when the page loads.
    Finally, you need to setup the template to send all the headers so, add;
    < ?php
    ob_end_flush();
    ?>

    At the end of your page.
    Now, the most important thing. FTP your block-random.php script into your WordPress folder, and simply use a PHP include. I have used it on my site as;
    < ?php include(ABSPATH . 'block-random.php'); ?>
    There you have it. A Random photo block for your WordPress Blog.

Viewing 3 replies - 16 through 18 (of 18 total)
  • I’ve got the same warning. Any help?

    Chewxy, I just went ahead and used a regular PHP include. I am not sure if this breaches security or anything but, here goes:


    <?php
    include 'https://www.mydomain.com/gallery/block-random.php';
    ?>

    It works fine for me. Give it a try.

    nodium

    (@nodium)

    Both Gallery and WordPress use the function stripslashes_deep.

    To get rid of the redeclaration error I had to edit util.php in the Gallery directory.

    Replace:

    function stripslashes_deep($value) {
    $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
    return $value;
    }

    With:


    if (!function_exists("stripslashes_deep")) {
    function stripslashes_deep($value) {
    $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
    return $value;
    }
    }

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Add the Gallery Random Block to WP’ is closed to new replies.