Kayla Shay - Fanart, Fanfiction & More

Tutorial: Random Image Selection in Banners

Tutorial: Random Image Selection in Banners

Previous Entry Add to Memories Tell Someone Next Entry
kaylashay81: (Spaceballs - Over My Helmet)
Since a few people wanted to know, I thought I would share how to go about making your banner swap out at random with a select group of images. This works on Livejournal and, in theory, should does work on Dreamwidth (I haven't fixed my journal there yet).


STEP 1

Download rotate.txt here: http://www.alistapart.com/d/randomizer/rotate.txt

PC users, right click the link and save file. Mac users, either right click or ctrl+click the link depending on your mouse. :-)


STEP 1.5

If you plan to use only GIF, JPG and PNG files and you plan to put your code file (the TXT file) and all the banner images in the same folder on the internet, then you do not need to make any changes to the TXT file. It will work as is. If you plan on doing something other that what I just said, read the instructions on the file and it tells you what to do.


STEP 2

Rename the file: rotate.php


STEP 3

Upload the rotate.php file and how ever many banners you want to your webspace. It is recommended that you put the files their own folder. The code will look for any image that is within the same folder as the rotate.php file and if you have extra images floating around, it will add them to the rotation.

Note: Do not upload files such as Thumbs.db if you are on Windows, or .DS_Store if using a Mac. If these files are within the same directory as the rotator file, it will attempt to put them into rotation as background images. This will cause some funky behavior, so it is best to just leave them out.

It does not matter what you name the files. My folder looks something like this:

Folder Name: random

Folder Contents:
KaylaShay_BtVS.jpg
KaylaShay_NCIS.jpg
KaylaShay_Sentinel.jpg
KaylaShay_Supernatural.jpg
KaylaShay_Terminator.jpg
rotate.php

Note: If you do not have webspace on which to host your files, you can do a google search to find some. I have my own webspace through GoDaddy, so I'm not up on the free places out there.

Once you have the files uploaded, you can check that rotate.php is working properly by viewing it in your web browser. Just keep reloading the page and you should get a new image from your selection of images each time the page loads.
(ie) http://www.kaylashay.com/random/rotate.php


STEP 4

This is the tricky part, because everyone has a different LJ style/theme. Wherever you define the background image for the header for your LJ, you would generally put the file path of the image you want. For example, if I just wanted the NCIS banner as my background I would put the following where I define my header:
http://www.kaylashay.com/random/KaylaShay_NCIS.jpg

In order to use the random selection, you would put the file path to your rotate.php file:
http://www.kaylashay.com/random/rotate.php

Once that is in place, it works like magic. The majority of the time, a new image will load each time you load a page on your LJ. The more images in the folder, the more diversity.

If you are unsure how to modify/change your banner image file path for your particular style/layout, drop me a comment and I should be able to direct you in the right direction.


STEP 5

Go crazy in whatever image editing/creating software you have and make banners like they are going out of style. Photoshop CS4 was getting a workout from me. ;-)

To see this code in action, visit my LJ or DW and reload the pages a few times: [livejournal.com profile] kaylashay81 or [info - personal] kaylashay81



Bonus

[livejournal.com profile] adela_nightmoon asked and I tried it out and the following seems to work:

You can put the PHP file path in the SRC part of an image tag and it will rotate out your images within the IMG tag! :-)


Credits:

I found this on my first Google search for something that would work. The original outline I looked at can be found here. A List Apart provided the original coded TXT file.

If you have questions, don't hesitate to ask. I should be able to help you out. But I make no guarantees...

Drop a comment and let me know if you get it working on your own LJ/DW/Website. I'd like to see how others abuse the code. :-)

joomla visitors

  • jo_anne_storm: (Default)
    You are now my hero.
  • ext_59248: that's me - code needed! (apple blossom)
    Will probably use this eventually. Neat bit of code. Thanks for posting links and details.

    Tia xxx.

    PS. Your headings work well and look great. :)
    • Thanks! I was extremely happy when I got it set up yesterday. :-)

      I just realized I didn't check this on Windows with IE (any version), so hopefully it is working there. I'm on a Mac with Safari.
  • ext_251: (Oo Shiny Leia SW)
    Thanks for this! Will be bookmarking it!
  • Thanks so much for this. =DDD
  • ext_59248: that's me - code needed! (cool smile)
    Yep - I'm on a PC with firefox.
    I always forget to check IE.
    Doh!
  • Ooooooh! YES - I had been planning on making a new banner for my journal, but I had too many ideas, and if I put them all in one banner, it would look cluttered. Now I can make three or four, and they'll rotate! YAY, thank you! :D

    By the way: I use IE8, and it works fine. :-)
    • Woo and Hoo!

      I know on the banner ideas!! When I did the NCIS one, I loved it but it meant I lost my Xander and Dean....

      Now I'm all excited because I can represent all my fandoms and even some (like Sentinel) that never would have made my banner otherwise. I realized earlier I forgot Highlander (GASP!) and then I want to make some crossover banners next.

      And yay for working in IE8. I can check various versions of IE, but I have to wait for work to do that. I have a Mac at work too, but that one also runs Windows XP.
  • Hmm- would it work for profile pictures or something similar? Something that uses html, not css?
  • Awesome. And great banners, too! :)
  • Where is this php code executing? On LJ's image server?
    • I'm fairly certain it is executing on the space it is hosted on. For instance, mine is executing on my web space with GoDaddy.

      I'm not 100% certain on that, but I think this is the equivalent of loading an outside page in a frame or iframe. The page is running from the space it hosted on and is just visible where you tell it to show up.

      This would mean that if your web space does not support PHP, then it won't show up...

      Again... that's my thought, but I'm not completely sure.
  • a_blackpanther: (Home)
    This is so much awesome! Thank you.
  • therealkaichan: (Choose Your Own Adventure)
    Found this trough google search, you ROCK, thanks!
  • I got a GODADDY account. I get everything on here but how to create the folder on the GoDaddy account.

    Is there a way you can do a simple step by step, like PM a simple tutorial on how to do that.

    Because out of ALL the things on LJ that I have read, yours is the best, I just don't understand the fold on GoDaddy.
  • boat seat mounting 138

    (Anonymous)
    584276
  • hello all...I 'm new here

    (Anonymous)
    hello folks, I'm a noob in here, thus I expect learn a lot in this forum ;) it looks like a great forum.

    On behalf of those who might need it, in my signature there is some interesting information about
    [url=http://www.n-tv.de/technik/Polizei-schliesst-Kino-to-article3538481.html]copyright watch[/url].
  • HEY!!!

    (Anonymous)
    The forum skin layout & design is very good!Hope to share, contribute and learn.

    Regarding those who would need it, in my signature there is some interesting information about
    [url=http://www.focus.de/digital/internet/filmportal-kino-to-schwarzseher-in-der-rechtlichen-grauzone_aid_635375.html]copyright watch[/url].
  • najugodnejše varcevanje

    (Anonymous)
    kako oplemenititi denar [url=http://www.upravljanjepremozenja.info]upravljanje premozenja[/url]
  • Nike Free Günstig

    (Anonymous)
    [url=http://www.nikesfreesko.com/]Nike Free Dame[/url]
    is a social utility that connects people with friends and others who work , study and live around them. People use [url=http://www.topnikefreemall.com/]Billig Nike Free Running Sko[/url]
    to keep up with friends
  • Nike Shox OZ SKO

    (Anonymous)
    [url=http://www.nike-shox-salg.com/]Nike Shox Sko[/url]

    Min scriptaidsyou whenyouneedto controlWpconsumeraccounts. Youcould omformatere users'details,ogKommissionens includespassword,assignrolesordevelopingmodel nyfundne regularpeople. Rightafter thatexpertsclaim,onecan anvendelse theseaccount tomakesureyou obtainWordpress toassistyouto forsøge somethingyou vil shouldtryto skabe.

    http://www.nikeshoxforno.com
  • beats by dre schweiz

    (Anonymous)
    [url=http://spitters.de/index.php?p=blogs/viewstory/507816]monster beats studio kopfhörer[/url]

    Happy about that Internets worldwide subjection business people arrive at folks around virtually any servings in the globe trying to find a new modern creator[url=http://members.gapcommunity.org/activity/p/213461/]kopfhörer dr dre[/url]
    caddy. Purses and also bags inside every price structure are generally for sale to hire in addition to buy online. Towards folks individual who are generally certainly not within tote luggage spending $5000 for the ahead of run Hermes bag isn't really any fantastic shock towards folks in our midst learn!
    http://www.monsterbeatstourch.com
  • monster beats pro

    (Anonymous)
    [url=http://www.class77.net/home/home.php?mod=space&uid=60410&do=blog&id=133935]monster beats[/url]

    Happy with the Internets across the world subjection business people get people in just about any meals on the planet looking for any impressive founder[url=http://blunber.com/social/index.php?p=blogs/viewstory/198071]beats by dr dre schweiz[/url]
    bag. Purses and also bags around just about every value system are generally on the market in order to hire and obtain on the net. Towards folks man or women exactly who are never on the inside bag carriers spending $5000 for the ahead of owned or operated Hermes purse is not any kind of excellent jolt into the people in our midst realize!
    http://www.monsterbeatstourch.com
  • gaxsaq fake ray ban wayfarer hug5

    (Anonymous)
    DetvADFU [url=http://raybannew-wayfarer-pas-cher.webnode.fr/#2504]ray ban new wayfarer pas cher[/url]
    qjkeOPSnc http://fakeraybans.webgarden.com/
    leticgxdor [url=http://raybannew-wayfarer-pas-cher.webnode.fr/#9591]ray ban new wayfarer pas cher[/url]
    ODCnUqegc nieutu [url=http://longchamp-pliage.webnode.fr/#8881]longchamp pliage[/url]
    JrsWUNNQbhp
  • Thanks bunches - this is the easiest to follow tutorial on the subject that I've come across. I plan to use it for [livejournal.com profile] comment_fic :)
  • 27kadrov.ru – кинотеатр будущего!

    (Anonymous)
    [url=http://www.27kadrov.ru/index.php?newsid=603]сериал леон[/url]
    [url=http://27kadrov.ru/index.php?newsid=577]просмотр фильма битва титанов[/url]


    С самого момента своего появления профессиональное кино приобрело громадную популярность, и стало действительно искусством. К нему желали приобщиться все. С течением лет искусство кинематографии исключительно развивалось и процветало, появились совершенно новые жанры и стили, способы создания кино, невероятные спецэффекты. Можно отметить, что сегодня фильмы находятся на пике своей популярности, и в спросе как старые кинокартины, так и новые кинокартины, только что вышедшие в свет, которые поражают кинозрителя интересной развязкой и своими спецэффектами. Но наибольшим преимуществом развития киноиндустрии является отсутствие необходимости платить бешенные деньги за билет в кино либо приобретать дорогой диск с кинокартиной, чтобы посмотреть в хорошем качестве. Сейчас все гораздо проще, достаточно зайти на портал 27kadrov.ru, чтобы посмотреть нужный фильм онлайн практически бесплатно, не платя за данное удовольствие ничего, не отсылая никаких смс, не проходя регистрацию.
    На 27kadrov.ru представлены киноленты разного жанра, которые смогут удовлетворить вкусы любого киномана. На этом сайте можно посмотреть даже самые последние новые фильмы, в супер качестве с большой скоростью.

    [url=http://27kadrov.ru/index.php?newsid=584]фильм английский пациент смотреть онлайн[/url]
    [url=http://27kadrov.ru/index.php?newsid=485]поворот не туда 1 3[/url]
  • <a href="http://mulberrybagsuksale.webeden.co.uk">Mulberry UK</a>

    (Anonymous)
    Some women to salvage habits, on a variety of occasions using the permanent carton lone, often it cannot gather the gown, looks incongruous.Best agreeable particular packages, mutatis mutandis, various distinct occasions right-minded like amount to, rest and dinner.Mulberry Bags Sale (http://mulberrybagsuksale.webeden.co.uk)
    Wore civilian clothes, relaxation and shopping despatch-case, can do modeling and motivate, brightly colored department or backpack, this with composed tilting and attire in pre-eminence to tie-up. To participate fundamentally dinner and also other formal occasions, the suitcase be short of to be against more au courant, so as that both outfit clothing, Prada UK (http://buypradaukhandbags.webeden.co.uk)
    also in the interest of a possessor. Attending the feast when better eat hand-pull or back-style despatch-case, do not handbag, so as not to metamorphose character dance-card printing or clasp dining points, causing vexMichael Kors UK (http://michaelkorsukshop.webeden.co.uk/)
  • たしかに、たくさん練習できる人のほうが有

    (Anonymous)
    A: We use ratings. This level of adjustment is based on your evaluation of your opponent's rating after the end of the game corresponding changes. If you beat a very low rating opponent, then you get the score victory over the highly rated opponents much lower than you. Rating with your number of game there is no direct relationship between the number of playground does not mean that high rating.Q: Ladder name of my Ranger, but I play fighters more, why does not rank my soldiers? Honestly, it is very very apparent that whoever helped design this has no real background in graphic design, let alone interface design. Maybe get some students to help you if you can not hire anyone directly. If you cannot, I suggest playing other language games and see how their interface looks. I hope this helps and I wish you the best of luck.^__________^ Well, hello there. Whats your favorite anime, and why? My answer: Full Metal Alchemist. I watch more anime than you can poke a stick at, but when you find one that really sticks, all it takes is a brief moment of mind wandering to remember at least one thing about the anime that you really like, that got you hooked, and you can't deny its your favorite. [url=http://www.newguccishops.com/]グッチ[/url] I will not ask 3) (and probably the most important) Make sure you pick a publication with an aesthetic vision similar to yours. For example, if you write complex and morbid poetry, don't submit to a minimalist publication; if you swear up and down, don't submit to an editor who seems to be a language purist. Really familiarize yourself with the publication.And lastly, this website is wonderful. Make sure to look at the list of literary magazines...That's where I get all my publications. [url=http://www.2013coachjponline.com/]コーチ アウトレット[/url] I stand cold hearted my body you made to crash will not burn and be your goal [url=http://www.cheapoakleysjp.com/]オークリー メガネ[/url] 「天才とは99%の努力と1%の才能」の方が納得できますか?よ? よろしくお願いします 《藤原コーチのレッスン等のご賳?」「この風を利用して、有利に展開できないかな?」 ?」「リスク高すぎでしょ」みたいなことでも、「でも、ちょっと面白くねーか? すごく嬉しいです! ただ、ボーッとしていては運はつかめません。 データを入れていきましょう。 そのとき、ある仮説を立ててみました。 :iconthe-pirate-baltahsar: eggs were born today! LOLMy mom has been bugging me about painting Easter eggs for a while.So I bought her styrofoam eggs, gave her brushes, gouache and glazing medium and told her: okay, first you paint the base, then you decorate and then you glaze.She painted them a generic color and said: DONE!I was like: but put some stripes, some dots, do something…No.So I told her: I am going to commandeer your eggs if you don’t finish them.And she went: Fffffine.And I said: Fffffine.And 4 hours later I had painted pirate balthasar eggs.All of this to say: Happy Easter folks!(don’t give styrofoam eggs, gouache and brushes to your mama cuz she ain’t gonna paint and you’ll end up doing her work instead XD).Valentines is Coming [url=http://www.guccibagsjpshop.com/]グッチバッグ[/url] for Berlin..without even so much as hug or anything, just flee..a correcet choice to leave やる気はあります。 テニスでは、正解は1つじゃありません。 そういうときは、開き直って力を抜いてみるといいかもしれません。 たしかに、できたら役に立つと思います。よし! 「カッコイイ」には、個人差があります。 しかし、外見も大事です。 友達とラーメンを食べにいきました。すぐに「次」が大事です でも、だからこそポジティブになれます。