borfast Posted January 24, 2004 Share Posted January 24, 2004 Since I've been asked several times about this, I thought I'd post a little how-to so everyone knows how to make a random avatar: http://borfast.com/random_avatar.php Hope you guys enjoy it Quote Link to comment Share on other sites More sharing options...
Lianna Posted January 24, 2004 Share Posted January 24, 2004 WHAAA! I got the hijack page! oooh, yup, I'm using the evil IE For others using the evil IE: click the link that says "continue browsing my website" Quote Link to comment Share on other sites More sharing options...
Lianna Posted January 24, 2004 Share Posted January 24, 2004 And now that I've read your How-to, I have a question. Let's say I want to use a mapped area of a single page on a website, instead of implementing this as an avatar on a forum... Quote Link to comment Share on other sites More sharing options...
stevevan Posted January 24, 2004 Share Posted January 24, 2004 Thanks, borfast! I suspected as much, but wasn't sure about the coding. Once my website comes back up, I'll have to try it! Quote Link to comment Share on other sites More sharing options...
borfast Posted January 24, 2004 Author Share Posted January 24, 2004 (edited) I forgot about the IE page! I never see it, since I never use IE I have to update it, some of the stuff I have there is not 100% correct... :\ And now that I've read your How-to, I have a question. Let's say I want to use a mapped area of a single page on a website, instead of implementing this as an avatar on a forum... I'm not sure about what you mean by "a mapped area of a single page"... but if you want to use a random image on a page, you just have to write the usual <img> tag and point the src attribute to the avatar.jpg file, just as you'd do when configuring an avatar. Is this what you wanted? By the way, Lianna, did you find it hard to understand where to click to keep browsing the website? I'm asking this because of the "warning" on your first post. It sounded like you got a bit lost, there, and were trying to prevent others from losing themselves, too. If so, I'd like to know, because although I want people to see that page, I don't want them to think that's all there is to see on my web site Edited January 24, 2004 by TCH-Raul Quote Link to comment Share on other sites More sharing options...
Lianna Posted January 24, 2004 Share Posted January 24, 2004 Raul, re: the hijack page...no, it just took me several seconds to realize what the page actually was and that it was a part of your site. Just didn't want folks to get freaked out when they got there and then just hurry close the page because they thought they really had been hijacked and bad things would come if they didn't leave right away. Does that make sense? re: image map, yes, that's exactly what I was talking about.... Say I have a large image on my home page and I want a portion of that image to display the random image generated....k, hang on, I'm making this much more difficult than necessary aren't I? Resolution: the large image should be the one with multiple versions and then randomized. (Sorry for my babbling everyone.) Anyway, you answered my question perfectly. Thanks! Quote Link to comment Share on other sites More sharing options...
borfast Posted January 24, 2004 Author Share Posted January 24, 2004 OK, I updated the page with a tip about using the random images on a web page Lianna, about the hijack page, I guess you're right, I have to change it a bit so people don't run away from my web site Thanks for the heads up About the image, if you have a large image that needs only a part of it generated randomly, what I'd do is slice the image in pieces, join them in a table (or, if you're feeling brave, using CSS ) and randomize only the... well, random part of it There's no need to make your site visitors download a new big file everytime. This way, the static parts of the image are cached by the browser, so they don't need to be downloaded again wasting your visitors' time and both yours and theirs bandwidth. Did I make sense? Quote Link to comment Share on other sites More sharing options...
Lianna Posted January 24, 2004 Share Posted January 24, 2004 Perfect sense and that's where I was going with my first thought. The big image to which I refer is only 20K compressed anyway, so not a huge consequence to make the alterations to it, rather than doing the slice work. Quote Link to comment Share on other sites More sharing options...
Madmanmcp Posted January 24, 2004 Share Posted January 24, 2004 Yeah, being "hijacked" was at first scary...but I know better and don't scare easy you just redirected the user to a different page based on their browser. Maybe some rewording so you don't really scare the viewers away from your site...the idea is to keep people there, not send them running for the kill button. Quote Link to comment Share on other sites More sharing options...
Bunni Posted January 24, 2004 Share Posted January 24, 2004 K, now I feel really dumb. The hijack page scared the crap outta me and after quickly perusing the first part of the page, I slammed my browser window shut! Tight! I came back here to continue reading this forum's messages and found out how silly I was. Went back to the page, saw the "continue..." link and continued on... feeling somewhat foolish.... Just thought I'd pop in and admit to my fears in case you were wondering if people were actually scared away and running for the kill switch. Quote Link to comment Share on other sites More sharing options...
Lianna Posted January 24, 2004 Share Posted January 24, 2004 Gotta admire your honesty, Bonnie! Don't feel silly....I was perched upon the "X" with the mouse pointer too! Quote Link to comment Share on other sites More sharing options...
borfast Posted January 24, 2004 Author Share Posted January 24, 2004 Thanks for the feedback about the hijack page I'll take care of it, just have to think about a better introductory text. What about the how-to/mini-tutorial? Has anyone tried it yet? When are we going to see a flood of random avatars here on the forums? Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted January 24, 2004 Share Posted January 24, 2004 Didn't scare me! But I read the page and proceded to download Firebird. But I still use IE as my default browser. Call me crazy! Quote Link to comment Share on other sites More sharing options...
boxturt Posted January 24, 2004 Share Posted January 24, 2004 (edited) Very neat Raul. I will have to find some images when I find some time (....approximately 3 minutes later.....................) It occurs to me that your code may well indeed come in handy to rotate sheet music and exercises on my lesson site. I will give credit of course, if it's ok to use? Edited January 24, 2004 by boxturt Quote Link to comment Share on other sites More sharing options...
borfast Posted January 24, 2004 Author Share Posted January 24, 2004 Bruce, I started my change a long time ago when I first tried Opera. I fell in love with it's tabbed browsing and a couple of weeks later, ditched both IE and Outlook Express. It was my first step to say "bye bye, virus and worms!" and to freedom Some time passed by and Mozilla started to become a usable browser. When Mozilla incorporated tabbed browsing, I made the switch and used it for both e-mail and web browsing until I completely stopped using Windows. After that I still used Mozilla for browsing the web but I started using Ximian Evolution for e-mail. Finally, when Firebird reached 0.6, I started using it exclusively for web browsing. If you dedicate some time (not much) to see the good stuff in Mozilla, I'm almost sure that you too will drop IE Quote Link to comment Share on other sites More sharing options...
borfast Posted January 24, 2004 Author Share Posted January 24, 2004 (edited) Tyler, it's more than OK for you to use it! I'll be happy if that code helps you with your tasks And you don't need to give me credit if you don't want to. Would be nice but it may require you to add ugly stuff to the page, so forget it and just use the code for whatever you want Edited January 24, 2004 by TCH-Raul Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted January 25, 2004 Share Posted January 25, 2004 Raul, I used Opera when it first came out. Then they went the way of ad support for the free version. I was also a proponent of Netscape before the browser war. Then IE just blew everyone away with IE4 and I gave up on Netscape. But I have to admit NS 7.1 isn't bad but I really like Firebird. Quote Link to comment Share on other sites More sharing options...
arvind Posted January 25, 2004 Share Posted January 25, 2004 what exactly is this ? I'm kinda confused ?? Quote Link to comment Share on other sites More sharing options...
borfast Posted January 25, 2004 Author Share Posted January 25, 2004 Arvind, this started as a post from me, about a little tutorial I made about how to make a random avatar, like the one I have here on TCH forums. Then we started talking about other stuff Quote Link to comment Share on other sites More sharing options...
borfast Posted February 3, 2004 Author Share Posted February 3, 2004 A bit off the original topic but since it was talked about later... I have updated the "hijack" page on my site. I think it won't scare people away, like this. http://borfast.com/msie.php By the way, has anyone tried the random image/avatar script? http://borfast.com/random_avatar.php Quote Link to comment Share on other sites More sharing options...
cloudrm Posted February 3, 2004 Share Posted February 3, 2004 I must have done something wrong, because I can't get it to work Quote Link to comment Share on other sites More sharing options...
boxturt Posted February 3, 2004 Share Posted February 3, 2004 I had tried to use it (altered) for something else (didn't work -MY fault) then I sorta forgot. But I'm using it now! I need to find some better pics though. Thanks again for sharing! Quote Link to comment Share on other sites More sharing options...
borfast Posted February 3, 2004 Author Share Posted February 3, 2004 cloudrm, can you describe the problem? What exacltly doesn't work? I'd like to make those steps as simple and easy as possible and if you didn't manage to do it, then I guess I could still improve the text Ty, did you use it for the random song box, on your guitar lesson pages? Pretty cool! Been there yesterday and noticed it. Couldn't help thinking if you had used it ;) Quote Link to comment Share on other sites More sharing options...
boxturt Posted February 3, 2004 Share Posted February 3, 2004 No, I didn't - but I may still. After figuring it out for the avatar today I realized why I couldn't get it to work for the random song box. So I may try it again! Quote Link to comment Share on other sites More sharing options...
cloudrm Posted February 4, 2004 Share Posted February 4, 2004 cloudrm, can you describe the problem? What exacltly doesn't work? I'd like to make those steps as simple and easy as possible and if you didn't manage to do it, then I guess I could still improve the text I'm not sure why it didn't work, I followed the instructions. I'll go back and try it again. created the text file . . .named it "avatar.jpg" created the text file . . .named it ".htaccess" created folder . . ."avatars" put all the photos in the folder with the new files. uploaded. . . changed the link . . just the dreaded box with the "red x" sounds cool if I can get it to work! Quote Link to comment Share on other sites More sharing options...
borfast Posted February 4, 2004 Author Share Posted February 4, 2004 (edited) cloudrm, when I try getting http://www.cloudroomstudio.com/avatars/avatar.jpg, I get the following error message: Warning: Cannot modify header information - headers already sent by (output started at /home/cloudro/public_html/avatars/avatar.jpg:2) in /home/cloudro/public_html/avatars/avatar.jpg on line 10 So that means there's something wrong with the PHP code in avatar.jpg. Could you please copy/paste it here so I can try to figure out what's wrong? By the way, nice avatars Are you into some sort of circles fanatism thing? Just kidding, the avatars are cool. I bet it'll look nice to see them all different but maintaining the circle pattern Edited February 4, 2004 by TCH-Raul Quote Link to comment Share on other sites More sharing options...
cloudrm Posted February 4, 2004 Share Posted February 4, 2004 <?php $dh = opendir("."); while(false !== ($file = readdir($dh))) if($file != ".htaccess" && $file != "avatar.jpg" && $file != "." && $file != "..") $filelist[] = $file; srand((double)microtime()*1000000); $picnum = rand(0, sizeof($filelist) - 1); header("Location: " . $filelist[$picnum]); closedir($dh); ?> that's the code I copied & pasted. I'm wondering if it has something to do with the jpg extension? the avatars are part of a series of abstract photo's that I sell/show etc. Quote Link to comment Share on other sites More sharing options...
borfast Posted February 4, 2004 Author Share Posted February 4, 2004 You did quite some cleaning job, there. But I don't see anything that could be causing the error. The error message says that the script output started on line 2, which means that it started on the line with the opendir() function. This means there's something going wrong while opening the directory. Try adding this at the beginning of the script, right after the opening <? error_reporting(E_ERROR | E_WARNING | E_PARSE); That should make opendir() spit out the error that's making it fail and let me know what it says. I'd bet it has something to do with permissions but it's really strange Quote Link to comment Share on other sites More sharing options...
cloudrm Posted February 4, 2004 Share Posted February 4, 2004 When you said "The error message says that the script output started on line 2", I checked the file & found that there was an extra return on the top line. Removed the return and . . . . Quote Link to comment Share on other sites More sharing options...
borfast Posted February 4, 2004 Author Share Posted February 4, 2004 (edited) Glad to see it works Just a tip: remove the htaccess.txt file from that directory, or else, sometimes the selected file will be that one and you'll get no image displayed - just like right now Edited February 4, 2004 by TCH-Raul Quote Link to comment Share on other sites More sharing options...
cloudrm Posted February 4, 2004 Share Posted February 4, 2004 OK, where should that file go? Update: I just put it in the main directory, seems to be working. Quote Link to comment Share on other sites More sharing options...
borfast Posted February 4, 2004 Author Share Posted February 4, 2004 It shouldn't go anywhere, the one you need is named .htaccess, not htaccess.txt. You can simply delete htaccess.txt since it is not needed Quote Link to comment Share on other sites More sharing options...
cloudrm Posted February 4, 2004 Share Posted February 4, 2004 gotcha Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.