HOME | DD

Grayda — Random images in your journal. by-sa

Published: 2006-12-01 13:41:59 +0000 UTC; Views: 4382; Favourites: 15; Downloads: 144
Redirect to original
Description This nifty little script does exactly as it says. It lets you display a random image each and every time your journal is loaded. The possibilities with this journal are endless. You can show off work from your gallery, or personal portfolio. You can make your journal's appearance change each and every time, even take it so far as to create a brand new journal each and every time you view it (Conditions apply ). It's up to YOU how you use it.

And configuration is dead easy. Just tell the script where your images are, and it does the rest! And it's easy to install too! Just upload to your website and it's ready to use!

** Requirements **

For this to work, you need some web space with PHP installed (most come with it installed these days anyway) and GD (Standard with most newer PHP versions).

** How to install **

Open up random.php in your favourite editor (Notepad works just as easily), and change the line with yoursite.com/image.jpg to whatever image you want to display.

Then upload it to your website (or someone else's if they're kind enough ;D), and add to your journal:



And that's it! All good to go! Or if you wish to use the webcam box to display the image, do the same as above, but don't include the
** Bugs **

Yes there are bound to be bugs. If you find one, let me know.

** Thanks **

Thanks to =ipholio who gave me the idea, and was going to do this script himself, but I beat him to it (Damn these late nights and frequent boredom strikes!). So inspiration goes to him, but coding credit goes to me, and also PHP.net which I used to look up function details and stuff.

In the next edition of: Getting the most out of your CSS Journals! I might just do a big thing about this, and show y'all how a journal can look with this baby running.

** Downloading **

Click the "Download" button to the left to download the ZIP file. Extract it, edit it and upload it. Easy!

C&C's are welcome, as are Faves.

Enjoy!
Related content
Comments: 46

gryphonworks [2008-01-05 08:22:24 +0000 UTC]

Ooh, this is just what I was looking for, but... I'm pretty sure I followed the instructions, yet nothing shows up on my journal header. ;_; The image URLs were added, the .php was uploaded, and I used the img src tags in the journal but it's not working. Doesn't help that I'm horrible at understanding all this coding... D: I wish I knew what was wrong here!

👍: 0 ⏩: 1

Grayda In reply to gryphonworks [2008-01-06 01:46:53 +0000 UTC]

It might be because deviantART is blocking such scripts, or perhaps they've changed the layout of their front page or something. I haven't updated this script in a long time () but I think I should, because there's still interest in it.

I'm in Chicago for 6 days from tomorrow, so I'll have a look when I come back if I can get the time. Thanks for the feedback, and thanks for trying this out

👍: 0 ⏩: 1

gryphonworks In reply to Grayda [2008-01-06 02:44:54 +0000 UTC]

Ohhhh I see. Heheh, I pretty much have zero knowledge in scripting language so I can't troubleshoot anything on my own. T_T At any rate though, if you'd be able to look into it later on I'd really appreciate it! Have fun on your trip!

👍: 0 ⏩: 1

Grayda In reply to gryphonworks [2008-01-06 03:38:31 +0000 UTC]

I learned PHP only 3 (or so) years ago and didn't really use it much until I started work mid last year. Now I can't live without it. My website runs on PHP, and my biiiig hardware database that tracks every computer at work, is run with PHP. It's well worth learning it if you have a need for it

👍: 0 ⏩: 1

gryphonworks In reply to Grayda [2008-01-06 04:30:32 +0000 UTC]

That's neat! I've tried to manage a little website and use basic HTML tools to post my art online, but got so frustrated with editing it that I just opted to just stick to websites like dA or photobucket where all I need to do is upload stuff. xD Before I found your randomizing image tutorial I was looking all over google for a way to make this script, and was confused with all the lingo. Said sites referred the viewer to teaching/introductory sites and I tried to read them but my brain just exploded, lol. I think I was just too frustrated to try and learn it from the base up, though.

👍: 0 ⏩: 1

Grayda In reply to gryphonworks [2008-01-06 05:00:32 +0000 UTC]

I get frustrated updating my own website too, so I developed my own tool called "sPage". Almost every page on the website is stored in a database. Then using FCKEditor, a "WYSIWYG" editor, you can edit your pages right from your browser. Sorta like a Wiki, but easier to use. That way you only have one page (more if needed) and you can manage your whole website without having to dive through directories and upload pages and stuff. I found it so handy, that I presented the idea to my work colleagues and now they've asked me to re-build their website using it. It's really quite handy. I suppose I'll make an installer out of it once I return to Australia and get my hands on the full-blown code.

But if you want to learn PHP, it's best to start small. Install something like XAMPP-Lite (from [link] ) and start out with some simple code from somewhere like [link] then modify. Hack at bits of code, change this for that and see what it does. Fiddle around and see what you can do. I HATE doing Database stuff, but luckily there's tools that people write that make databases as simple as 3 lines (and I use it extensively at work. It's a bloody lifesaver! )

Best of luck if you do decide to go down this path

👍: 0 ⏩: 1

gryphonworks In reply to Grayda [2008-01-06 05:45:12 +0000 UTC]

Sounds cool, I might take a second shot at it in the future. For me, learning PHP is more for recreation purposes than anything else, so I can take it slow. (Sure hope they don't try to sneak PHP into the nursing school curriculum...!) xP Thanks for the tip~

👍: 0 ⏩: 1

Grayda In reply to gryphonworks [2008-01-06 07:48:07 +0000 UTC]

Unfortunately I had to learn PHP on my own. Fortunately I did it during a boring class that taught a language NOBODY in the whole world uses (or would dare to use) so when they teach you something completely boring, sneak off, jump on the machine that does CAT scans or something, fire up some PHP and completely block the medical system for a few hours while you gain some knowledge

👍: 0 ⏩: 1

gryphonworks In reply to Grayda [2008-01-06 08:53:51 +0000 UTC]

lol, you crazy! xD

👍: 0 ⏩: 0

33xiT [2007-07-09 23:38:04 +0000 UTC]

This also work for Webcam

👍: 0 ⏩: 1

Grayda In reply to 33xiT [2007-07-23 23:02:26 +0000 UTC]

Indeed it does. Thanks for the link

👍: 0 ⏩: 1

33xiT In reply to Grayda [2007-07-23 23:19:59 +0000 UTC]

You're welcome

👍: 0 ⏩: 0

Hexaditidom [2007-03-05 20:36:31 +0000 UTC]

Sounds easy enough It seems tripod won't let me do php. Can you recommend any free sites that support it?

👍: 0 ⏩: 1

Grayda In reply to Hexaditidom [2007-03-06 10:01:53 +0000 UTC]

Depending on what sort of internet you're on, you can do it all yourself. Just download a small pack like CDSite or other AMP (Apache, MySQL, PHP) pack, and host it on your computer. Failing that, there's a few free hosting sites out there. I can't remember any of them, and the free one I'm using has been sold off and it's $1 for 3 months there. Try asking in the dA forums. You'll see some great stuff in there ;D

Best of luck!

👍: 0 ⏩: 0

LeonaWindrider [2007-02-11 12:58:26 +0000 UTC]

This is so sweet! I'll be redesigning my journal shortly, and will defiantly be including this code in it. I'll let you know when I do

👍: 0 ⏩: 0

Funky-Chickin [2007-02-09 02:42:33 +0000 UTC]

is there anyway to make this work with .png's?
or at least make the output of the image highter quality, it seems to reduce the quiality somewhat when its re-rendering them!

👍: 0 ⏩: 1

Grayda In reply to Funky-Chickin [2007-02-09 04:43:29 +0000 UTC]

Absolutely! Open up the PHP file, and find this line:

header ("Content-Type: image/jpeg");

change it to:

header ("Content-Type: image/png");

Then find these lines:

$im = @ImageCreateFromJPEG ($image[$random]);
imagejpeg($im);

change them to:

$im = @ImageCreateFromPNG ($image[$random]);
imagepng($im);

And it should work! Keep in mind I haven't tested it, but it should work.. best of luck

👍: 0 ⏩: 1

Funky-Chickin In reply to Grayda [2007-02-09 15:10:20 +0000 UTC]

Hmmm, it does work, but not with the desired effect. it doesn't keep the transparency, and puts a black background on everything. Thanks for the help, i shall now search the web!! *gulp*

👍: 0 ⏩: 1

Grayda In reply to Funky-Chickin [2007-02-10 14:01:26 +0000 UTC]

Best of luck! There's probably some PNG stuff I didn't look into (ie. extra parameters to the GD library), but I dunno. Good luck with your search

👍: 0 ⏩: 0

Nauco [2007-01-28 19:57:19 +0000 UTC]

I now have one up and running...
It's my webcam if you'd like to see...

👍: 0 ⏩: 1

Grayda In reply to Nauco [2007-01-29 00:46:40 +0000 UTC]

Looking good! I take it it was easy to set up?

Thanks for being possibly the first person to use this script

👍: 0 ⏩: 1

Nauco In reply to Grayda [2007-02-02 16:38:02 +0000 UTC]

The first... but it's easy as hell..!
Thanks for leting me use it...

👍: 0 ⏩: 1

Grayda In reply to Nauco [2007-02-03 02:45:48 +0000 UTC]

I believe you're the first after myself.. I haven't used it since I made it.. so you're the first known person to use it

And you're welcome. It's open-source and took a few minutes to do, so it's nothing ;D

👍: 0 ⏩: 1

Nauco In reply to Grayda [2007-02-03 10:33:40 +0000 UTC]

hehe... I know...
But... You wouldn't by any chance know how to set up a guestbook in php? I'm having some problem with that on my site... [link]

👍: 0 ⏩: 1

Grayda In reply to Nauco [2007-02-05 11:40:53 +0000 UTC]

Take a look at [link] you should find some VERY easy to install PHP guestbooks. And the site is looking awesome so far! The gallery script is looking hot too. Which script is that? I'm interested..

👍: 0 ⏩: 1

Nauco In reply to Grayda [2007-02-09 11:28:36 +0000 UTC]

The script was included in the program I'm using... Site Studio 6... I'm looking in to the site you sent me, and I'll give you a shout when i have a proper guestbook... But thanks for the feedback...

👍: 0 ⏩: 1

Grayda In reply to Nauco [2007-02-13 13:24:26 +0000 UTC]

You're welcome! Best of luck!

👍: 0 ⏩: 0

sgeos [2007-01-14 13:15:23 +0000 UTC]

Grayda, this is a really neat idea.

-Brendan

👍: 0 ⏩: 1

Grayda In reply to sgeos [2007-01-15 02:50:31 +0000 UTC]

Thanks! I've got a few new ideas in store. I had thoughts of a guest-book or shoutbox for dA journals or the webcam space on the userpage. The possibilities are endless

Thanks again!

👍: 0 ⏩: 1

sgeos In reply to Grayda [2007-01-15 16:55:03 +0000 UTC]

Very welcome! Good luck with the scripts!

-Brendan

👍: 0 ⏩: 0

Nakoo-The-Tauren [2006-12-02 01:25:48 +0000 UTC]

This sounds awsome.
How come you come up with all the great Ideas.

👍: 0 ⏩: 1

Grayda In reply to Nakoo-The-Tauren [2006-12-02 02:40:32 +0000 UTC]

Well it's not that great of an idea really. It's pretty common-place out there on the web. I just made it into something dA can use. If you really want to see good ideas, you should check out =dancewiththesky coz they've got some really killer ideas for dA..

👍: 0 ⏩: 1

Nakoo-The-Tauren In reply to Grayda [2006-12-03 10:06:50 +0000 UTC]

O:

👍: 0 ⏩: 1

Grayda In reply to Nakoo-The-Tauren [2006-12-03 12:27:55 +0000 UTC]

exactly!

👍: 0 ⏩: 0

ahedrick201 [2006-12-01 17:40:58 +0000 UTC]

Wonderful idea.

👍: 0 ⏩: 1

Grayda In reply to ahedrick201 [2006-12-02 00:36:04 +0000 UTC]

Thanks! I hope you get some use out of this

👍: 0 ⏩: 0

Miracle-Worker [2006-12-01 16:53:22 +0000 UTC]

Cool! I now REALLY need to get a subscription...

👍: 0 ⏩: 1

Grayda In reply to Miracle-Worker [2006-12-02 00:37:28 +0000 UTC]

haha thanks! Good luck with that! There's still some competitions out there for journals and stuff, but I have a funny feeling we've been over all this before

Thanks again, and thanks for the fave!

👍: 0 ⏩: 1

Miracle-Worker In reply to Grayda [2006-12-03 12:53:38 +0000 UTC]

Yeah, I believe we have gone over this before. I'm just bombarded with sooo much homework, so I can't do anything about it...

👍: 0 ⏩: 1

Grayda In reply to Miracle-Worker [2006-12-04 11:37:15 +0000 UTC]

I wish I could say I knew the feeling, but I don't. I barely studied at school. In years 11 and 12 I had to, because of the looming end of year exams, but other than that, I never could concentrate for long enough. My mind was all over the place..

👍: 0 ⏩: 0

WeLoveGrayda [2006-12-01 15:53:03 +0000 UTC]

Just kidding, unfortunately. It rocks Graydeeeeeeeeeeeeeeeee! *muah*

👍: 0 ⏩: 0

WeLoveGrayda [2006-12-01 15:52:01 +0000 UTC]

THIS IS HORRIBLE

👍: 0 ⏩: 0

ProsePetals [2006-12-01 13:43:38 +0000 UTC]

This looks cool.

👍: 0 ⏩: 1

Grayda In reply to ProsePetals [2006-12-01 13:44:43 +0000 UTC]

Thankyou! And thanks for the I hope you get lots of use out of this! And if you ever need help setting it all up, don't hesitate to let me know

👍: 0 ⏩: 1

ProsePetals In reply to Grayda [2006-12-01 14:10:41 +0000 UTC]

Absolutely. I've been in the process of reinstalling everything on the computer (crashed about 2 weeks ago)...and haven't gotten to everything yet....but when the time comes, I will let you know.

And you're welcome for the This is just really cool.

👍: 0 ⏩: 1

Grayda In reply to ProsePetals [2006-12-02 00:39:03 +0000 UTC]

The PC in the loungeroom needs a format. It's not that old, but needs a clearing out.. either that or more RAM. I think it's the latter.. But yeah just catch me via a note or something when you're ready to set this baby up and I'll give you a hand

-G

👍: 0 ⏩: 0