A random banner for wordpress

Hello,

When I saw the first time the effervescence_simpleviewer theme, I found that the random banner, extracting only a piece of an image, was a really good idea : you get a totally new picture every reload, sometimes you do not recognize the one it is extracted from... Excellent,
I use it for my Zenphoto gallery now. and this was done using customfonctions.php from that theme. Then you only need to add the following to index.php :
`

<?php printHeadingImage(getRandomImages()); ?>

`
Now I would like to do the same banner for my wordpress blog : I had a look yesterday, trying to add the effervescence_simpleviewer customfunction to my wordpress theme, then adding most of all zp-core files... ;-) ... then failed with a message such like "album not found". Then I read some posts here (I should have started here may be), and saw it was not something so easy to do.

My question is : what is the easiest way to achieve that ? There is a plugin named ZENpressed with a random function. Could it be feasible to mix that random function and the one from the plugin ? I believe using plugin may help from a numbers of potential problems...

Any suggestion would be nice.
Thanks.

Comments

  • hi pled

    I intergrated wordpress ala ruzee's method as I decribed also in this thread: http://www.zenphoto.org/support/topic.php?id=2484#post-14802

    just did a try out putting the effervescence heading in my wordpress sidebar and it did work.

    I did it this way.

    I made a php file called heading.php in which I put the effervescence code as written below and then ftp this file to my zenphoto current theme directory.
    in the wp-sidebar (or in your case header) I put this line:

    `<?php include("http://www.yourdomain.com/zenphoto/?p=heading"); ?>`

    and voila, a random effervescence heading image appeared on all the zenphoto pages in which I called the wp-sidebar.

    content of heading.php

    `<?php<br />
    function printHeadingImage($randomImage) {

    $id = getAlbumId();

    if (is_null($randomImage) || checkforPassword(silent)) {

    $randomImage= new Image(new Album(new Gallery(), ''), 'zen-logo.jpg' );

    }

    if (!is_null($randomImage)) {

    echo '
    ';

    $randomAlbum = $randomImage->getAlbum();

    $randomAlt1 = $randomAlbum->getTitle();

    if ($randomAlbum->getAlbumId() <> $id) {

    $randomAlbum = $randomAlbum->getParent();

    while (!is_null($randomAlbum) && ($randomAlbum->getAlbumId() <> $id)) {

    $randomAlt1 = $randomAlbum->getTitle().":n".$randomAlt1;

    $randomAlbum = $randomAlbum->getParent();

    }

    }

    $randomImageURL = getURL($randomImage);

    echo "image
    $randomImage->getCustomImage(NULL, 620, 180, 620, 180, NULL, NULL, !getOption('Watermark_head_image')).

    "' width=620 height=180 alt=".'"'.

    htmlspecialchars($randomAlt1, ENT_QUOTES).

    ":n".htmlspecialchars($randomImage->getTitle(), ENT_QUOTES).

    '" />
    ';

    echo '
    ';

    }

    }

    printHeadingImage(getRandomImages()); ?>`
  • ps..thanks for the hint to a ubuntu counter on your site :-)
  • pled Member
    Hi Bert,

    Thanks a lot for your answer.
    I did that on my local (Ubuntu) desktop :-) : creating the heading.php file in my zenphoto current theme directory (testing-dev), then inserting the "include" in my header.php (from my wordpress theme directory).

    The include works, but I get the following error :

    Fatal error: Call to undefined function checkforPassword() in /var/www/wordpress/zenphoto/themes/testing-dev/heading.php on line 4

    When reading your post : does that mean I have to integrate Wordpress in zenphoto prior to do that ?
    Sorry if my question is stupid, but I am a little bit lost.
  • acrylian Administrator, Developer
    You get the error because the zenphoto functions are unknown if you just add the above posted code. There are several links within the thread Bert mentioned that explain how to do it.
  • pled Member
    Great thanks !! IT WORKS !!

    I started adding the following to my wordpress header :

    `

    <?php<br />
    define('ZENFOLDER', 'zp-core');

    define('WEBPATH', 'http://127.0.0.1/wordpress/zenphoto');

    require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");

    ?>

    `

    But I got exactly the same error... and yesterday, i did a 'grep' through all files for that checkforPassword function without success.
    As I was not using the last version (v1.1.2), I downloaded v1.1.5, and here it was : checkforPassword did not exist with my version !
    Finaly, I don't even need to add the above code in the header. It works without it.

    So I am VERY happy, I can go further customizing my new wordpress theme.

    From all that and from what I read in this occasion, the idea to integrate either wordpress in Zenphoto or zenphoto into wordpress is something I discovered. There are so many things possible I should look at !

    Thanks again for your support, Zenphoto is great !
Sign In or Register to comment.