effervescence+ remove random function of heading image

djoel Member
Hi,

What do I have to modify in the following code to get rid of the random function and to specify one image to be displayed as heading image?

function printHeadingImage($randomImage) {
global $_zp_themeroot;
$id = getAlbumId();
echo '<div id="randomhead">';
if (is_null($randomImage)) {
echo '<img src="'.$_zp_themeroot.'/images/header_zp.jpg" alt="'.gettext('There were no images from which to select the random heading.').'" />';
} else {
$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 = htmlspecialchars(getURL($randomImage));
if (getOption('allow_upscale')) {
$wide = 620;
$high = 180;
} else {
$wide = min(620, $randomImage->getWidth());
$high = min(180, $randomImage->getHeight());
}
echo "<img src='".
htmlspecialchars($randomImage->getCustomImage(NULL, $wide, $high, $wide, $high, NULL, NULL, !getOption('Watermark_head_image'))).
"' width='$wide' height='$high' alt=".'"'.
htmlspecialchars($randomAlt1, ENT_QUOTES).
":\n".htmlspecialchars($randomImage->getTitle(), ENT_QUOTES).
'" />
';
}

Thank you

Comments

  • Modify the file /themes/effervesence_plus/functions.php, line 152.

    I haven't played with this theme, so I don't know what issues there may be with breaking the layout if you use a differently sized image, but regardless, that's where the line is that prints the image heading for each of the theme pages.
  • Actually, I'll post the block of code also, in case you've already modified the file and it's not line 152 anymore:

    `
    function printLogo() {
    global $_zp_themeroot;
    if ($img = getOption('Graphic_logo')) {
    echo 'Logo';
    } else {
    $name = getOption('Theme_logo');
    if (empty($name)) {
    $name = sanitize($_SERVER['HTTP_HOST']);
    }
    echo "

    $name

    ";
    }
    }
    `
    It would be the line that reads: echo '<img src="...

    Now that I look at it, it would seem that you can probably select the logo image from the theme options page, as long as you put the logo image in the /themes/effervesence_plus/images folder.
  • Well, now I've looked more closely at the theme, and I see which image you're talking about. So, now I think I can answer the question you asked, not the one I thought you meant :-)

    Perhaps the easiest way is to modify the function you posted in your original post. Add the following line above the one beginning with 'global $_zp_theme_root;':

    $randomImage = NULL

    That will force it to use the hard-coded image a few lines down. Now, modify that line to point to the image you want to use - again, noting that a differently sized image may adversely affect the theme layout. The line to modify is:

    `
    echo ''.gettext('There were no images from which to select the random heading.').'';
    `
    In the above line, if you put the image in the theme's images folder, just replace 'zen-logo.jpg' with the filename you use.

    Hope that helps!
  • djoel Member
    Thank you for your help. I don't have time to check it now. As soon as I checked I'll post the results.

    Thank you again
  • djoel Member
    Ok I've checked it and the code works perfectly. Just have to cut the image to make it fit...

    Thank you very much Blue Dragonfly!!!
Sign In or Register to comment.