What's new

Check out my signature (1 Viewer)

JJR512

Supporting Actor
Joined
Dec 11, 1999
Messages
619
Real Name
Justin J. Rebbert
I wrote a little PHP script that randomly selects a new image file from a stockpile of 34 images. All 34 are screenshots from the QuickTime Star Wars Episode 2 trailers. The script file is run every hour on the hour by a cron job setup through my website. So ever hour, on the hour, there will be a new image in my signature. I thought it was cool... :)
 

Jeffrey Forner

Screenwriter
Joined
Jun 19, 1999
Messages
1,117
Very nice!

One suggestions though: You might want to make the picture a little smaller. Right now, it's taking up more room than the post itself. Plus, people with slower internet connections may not like having to wait for those pictures to load everytime you post in a thread.

Still, I like that idea! If I wanted to put a picture in my signature file again, I'd like to know how you did it.
 

JJR512

Supporting Actor
Joined
Dec 11, 1999
Messages
619
Real Name
Justin J. Rebbert
I did read the announcement beforehand, and I had thought it was referring to file size. The reason I assumed that is because I was once asked to reduce the file size of my previous signature image. This is what used to be in my signature:
swouttakes.jpg

As you can see, that image file is around 28kB. All the images I'm using now are around 7kB; some a little more, some a little less, but the point is, I thought if 28kB was OK, surely these smaller ones would be OK.
But now it looks like you're talking about physical dimensions, that the height and/or width of the image are too large. The trouble with that announcement is that it doesn't say what, exactly, it's talking about, nor provide any boundaries. I hate to draw comparisons, but in the vB board that I run, I put it into the rules that signature images must be no larger than 150 pixels tall or 600 pixels wide, with a file size no larger than 15kB. Those hard limits make it easy for me to tell someone their signature image is too large; I can quote the rules, and there's no denying it. It prevents people from asking me the same question that I now have to ask you: How large is too large? How much smaller will be small enough?
***
Some people have asked me how I do it.
Below is the code that I wrote to change the image. This file, along with the 34 separate image files, are in the same directory in my webhosting account. The image files are named swep2_xx.jpg, where xx is a number from 01 to 34. There is a separate image file, named swimgfile.jpg, which is the actual image in my signature. The code is run every hour on the hour by a cron job (0,*,*,*,*,"GET http://www.jjr512.com/images/swep2_s.../swep2_gen.php > /dev/null").
The first few lines generate a random number from 1 to 34. If the number is 9 or less, a 0 is added to make it a double-digit number. The unlink statement deletes the current signature image file (the file named swimgfile.jpg), and the line after it copies the image file with the new random number in its name to a new file named swimgfile.jpg.
This code is the entire file named swep2_gen.php:
PHP:
 

JJR512

Supporting Actor
Joined
Dec 11, 1999
Messages
619
Real Name
Justin J. Rebbert
OK, I made copies of all 34 files in a smaller 125-pixel-tall format. I rewrote the script to also copy one of the smaller files to another filename that is used here, so I can use the small one here and the larger one on my site and at other places. The two different sizes will stay synched, in other words be the same image, just in different sizes.
 

TheoGB

Screenwriter
Joined
Jun 18, 2001
Messages
1,744
Incidentally I belive 5 or 6 lines of text is listed as the vertical dimension of the signature. You could ALT+PrtScn, paste into Photo editor and then cut out 5 or 6 lines and see how many pixels that was high...

You have a lot of text on yours too so it should be smaller I'd say...
 

JJR512

Supporting Actor
Joined
Dec 11, 1999
Messages
619
Real Name
Justin J. Rebbert
TheoGB, I have read and reread and rereread the announcement and there is no such reference to "5 or 6 lines" that I can see.
Jeffrey_Jones, you are correct. I was originally going to do "less than 10" but then decided to change the operator to "less than or equal to" but forgot to change the number. Thanks for pointing that out! :)
 

Frank Anderson

Senior HTF Member
Joined
Jun 7, 1999
Messages
2,667
Justin,

You will find this under the Edit Profile option

Signature:

Optional signature you may use to appear at bottom of your posts.

1. You have to use vB Code in your signature. HTML is not allowed.

2. Image size: Keep the size small, horizontally and vertically. Any image taller than about 6 to 8 lines of text is too big. Keep it to less that 125 pixels tall and 425 pixels wide.

3. File size: Below 25kb. Anything more is unnecessary. You may have cable or DSL but a lot of people don't.
 

TheoGB

Screenwriter
Joined
Jun 18, 2001
Messages
1,744
Yeah, sorry Justin - I meant to say it was in the Edit Profile bit where you enter your sig code...;)
 

Parker Clack

Schizophrenic Man
Moderator
Senior HTF Member
Joined
Jun 30, 1997
Messages
12,228
Location
Kansas City, MO
Real Name
Parker
Justin:

So you are JJR512. I never put the your username here and your name on vBulletin.org together.

Is there anyway to do this without having to set up a cron job to change out the pictures?

Parker
 

JJR512

Supporting Actor
Joined
Dec 11, 1999
Messages
619
Real Name
Justin J. Rebbert
Yep, it's me! :D
I don't know of another way to do it. I'm sure there is one. I would be very surprised if there wasn't one. But I haven't been able to figure anything else out yet.
I could come up with a way to rotate an image on a page on a per-page-load basis, rather than on a timed basis. For example, I could make a different image appear in a particular spot on a page every time that page was loaded. That could be easily done with a little function inserted into the code for that page.
I think you could use a time-based rotation using javascript. I'm sure you could put some javascript into the header of a particular page that would rotate an image. That's the basic way a rotating banner ad works, usually. But because that is run on the user's computer, not everybody would see the same image at the same time. Unfortunately, I know nothing about javascript, and would have idea how to code that.
So there are a few different possibilities available. But so far, a cron job running a script on a schedule is the only way I know of to do exactly what I'm doing, which is have the same single image shown to everybody for a set amount of time. So it depends on what exactly you want to do.
I love a challenge. I assume that you asking indicates there is a specific task you would like to be able to do, or maybe there is a general concept that you would like to flesh out into a full blown idea. Can you tell me what it is you're thinking of, and I'll see if I can do it or help you do it? :)
 

Jeffrey_Jones

Second Unit
Joined
Nov 6, 2001
Messages
283
Is there anyway to do this without having to set up a cron job to change out the pictures?
I have created an HTML page (based on your question) that uses JavaScript to change an image on a timed basis. The images are loaded into an array and then dynamically changed based on the current interval. The interval is set in seconds but that could be changed. I'm sure the array could be dynamically generated as well.

Please note that I have changed '' tags to '-' for display purposes only. You should change them back before using the code.

/******Image Swap Code*******/

-html-

-HEAD-

-SCRIPT LANGUAGE="JavaScript"-

-!-- Image Swap Code

var Delay = 2; // delay time in seconds

var Pictures = new Array

("image1.jpg"

,"image2.jpg"

,"image3.jpg"

);

var ArrayLength = Pictures.length;

Delay *= 1000;

var PicCurrentNum = 0;

var PicCurrent = new Image();

PicCurrent.src = Pictures[PicCurrentNum];

function StartPictureShow()

{

setInterval("slideshow()", Delay);

}

function slideshow()

{

PicCurrentNum++;

if (PicCurrentNum == ArrayLength)

{

PicCurrentNum = 0;

}

PicCurrent.src = Pictures[PicCurrentNum];

document["pictureshow"].src = PicCurrent.src;

}

-/script-

-/HEAD-

-BODY OnLoad="StartPictureShow()"-

-img name="pictureshow" src="image1.jpg"-

-/BODY-

-/HTML-
 

Parker Clack

Schizophrenic Man
Moderator
Senior HTF Member
Joined
Jun 30, 1997
Messages
12,228
Location
Kansas City, MO
Real Name
Parker
Justin:

Really the only thing that I am wanting to make sure of is that the code that is running the rotation of the images is hosted and executed on the server that hosts the pictures and not contained in the signature of a member. It looks like that is exactly what your script does.

Jeffery:

So do you load this javascript up on your server along with your images and then link to the .html page in your signature to draw up the images or what?

Thanks,

Parker
 

Bill Slack

Supporting Actor
Joined
Mar 16, 1999
Messages
837
You can have a CGI (or JSP/PHP or whatever) program the outputs an image (so long as vbulletin board likes this) so im the img tags you'd have Link Removed and have the randomly select an image. I used to have an image based counter that worked in a way like this.
I finally got around to putting the pic below in my sig after months of saying I would. :b :)
Doh. My free host doesn't work though. Heh.
 

JJR512

Supporting Actor
Joined
Dec 11, 1999
Messages
619
Real Name
Justin J. Rebbert
What do you have to do to make that work...specifically, with PHP, what exactly makes the output? I mean, do you write it as a function that returns the file name of the image, or what.
 

Users who are viewing this thread

Sign up for our newsletter

and receive essential news, curated deals, and much more







You will only receive emails from us. We will never sell or distribute your email address to third party companies at any time.

Forum statistics

Threads
357,052
Messages
5,129,655
Members
144,285
Latest member
acinstallation715
Recent bookmarks
0
Top