WordPress.org

Ready to get started?Download WordPress

Forums

Random Logo Image - please help! (7 posts)

  1. Saul76
    Member
    Posted 4 years ago #

    Hello everyone - hoping someone can help me.

    1st off, the website in question is http://www.airfoolers.com for reference.

    I am 'trying' to make my header 'logo' image a random image that changes each page refresh. Should be easy enough right? Well I've tried for two days to do this with every script and php call I've found online and nothing works.

    I know I am probably overlooking something obvious ...

    Example, I have made 12 'logo' images of the same size and named them img_1.jpg through img_12.jpg

    I have placed them in a seperate folder within the themes images folder.

    I have created a php file from code found online that was created to rotate the images. I've named it rotate.php as instructed and placed it in the folder with the images.

    I pull up my style.css file and scroll down to where my logo file code is ..

    It was set to this which displays a logo just fine ..
    #logo {
    height: 260px;
    background:url("images/bgimage/img_5.jpg")
    no-repeat left top;

    I changed it to this hoping to 'call' the php file but when I do I just get a 'blank' image.

    #logo {
    height: 260px;
    background:url("images/bgimage/rotate.php")
    no-repeat left top;

    I have no idea if I need to edit my header.php file too? If so which part of the code?

    Please - hopefully someone understands my problem and can help?

  2. alism
    Member
    Posted 4 years ago #

  3. Saul76
    Member
    Posted 4 years ago #

    Hoping someone can troubleshoot the actual code I posted.

  4. Saul76
    Member
    Posted 4 years ago #

    Really hope someone can provide a fix/solution - maybe see a mistake in the code or what not?

  5. gworks
    Member
    Posted 4 years ago #

    is rotate.php printing anything to the screen? Make sure it has an echo/print because it needs to return the image name. You can call the file directly to test, like http://airfoolers.com/path/path/....rotate.php and it should print the image to the screen.

    gworks

  6. Saul76
    Member
    Posted 4 years ago #

    Thank you for the reply ...

    rotate.php is not printing anything to the screen I guess.

    http://airfoolers.com/wp-content/themes/airfoolers/airfoolers/images/bgimage/rotate.php in the browser gives me this error.

    Warning: opendir(http://www.airfoolers.com/wp-content/themes/airfoolers/airfoolers/images/bgimage/) [function.opendir]: failed to open dir: not implemented in /home/saul/public_html/wp-content/themes/airfoolers/airfoolers/images/bgimage/rotate.php on line 171

    Warning: readdir(): supplied argument is not a valid Directory resource in /home/saul/public_html/wp-content/themes/airfoolers/airfoolers/images/bgimage/rotate.php on line 172

    Warning: closedir(): supplied argument is not a valid Directory resource in /home/saul/public_html/wp-content/themes/airfoolers/airfoolers/images/bgimage/rotate.php on line 180

    Warning: Cannot modify header information - headers already sent by (output started at /home/saul/public_html/wp-content/themes/airfoolers/airfoolers/images/bgimage/rotate.php:171) in /home/saul/public_html/wp-content/themes/airfoolers/airfoolers/images/bgimage/rotate.php on line 195
    ‰PNG  ��� IHDR���d���d���J,���PLTEÿÿÿ���UÂÓ~���TIDAT8c3ž(ðü@íó¾ 0QZS„ÁQ$ÐÂueAá±7TÂy‚µ& ŽÏ'Bõ ºõ¹  ñT&z@mpÚ âçBW‚Q0 F‘��åå×X‹Ü4����IEND®B`‚

    Can you decipher what that means? Please.

  7. gworks
    Member
    Posted 4 years ago #

    Opening http://airfoolers.com/wp-content/themes/airfoolers/airfoolers/images/bgimage/rotate.php, I can see images being displayed. What is happening is that the file is returning the image and not it's url ( which is what you need). You can use that in an image tag in your html. Like so:

    <img src="http://airfoolers.com/wp-content/themes/airfoolers/airfoolers/images/bgimage/rotate.php">

    To use it in a stylesheet, you would need to modify the code, eliminating the image mime type so the file echos a url rather than return the image.

Topic Closed

This topic has been closed to new replies.

About this Topic