Check out my signature

Discussion in 'Archived Threads 2001-2004' started by JJR512, Apr 14, 2002.

  1. JJR512

    JJR512 Supporting Actor

    Joined:
    Dec 11, 1999
    Messages:
    619
    Likes Received:
    0
    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... [​IMG]
     
  2. Jeffrey Forner

    Jeffrey Forner Screenwriter

    Joined:
    Jun 19, 1999
    Messages:
    1,117
    Likes Received:
    0
    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.
     
  3. Jens Raethel

    Jens Raethel Second Unit

    Joined:
    Oct 27, 1998
    Messages:
    473
    Likes Received:
    1
    Real Name:
    Jens
    Cool idea!
     
  4. Frank Anderson

    Frank Anderson Cinematographer

    Joined:
    Jun 7, 1999
    Messages:
    2,667
    Likes Received:
    0
  5. JJR512

    JJR512 Supporting Actor

    Joined:
    Dec 11, 1999
    Messages:
    619
    Likes Received:
    0
    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:
    [​IMG]
    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:
     
  6. Frank Anderson

    Frank Anderson Cinematographer

    Joined:
    Jun 7, 1999
    Messages:
    2,667
    Likes Received:
    0
     
  7. JJR512

    JJR512 Supporting Actor

    Joined:
    Dec 11, 1999
    Messages:
    619
    Likes Received:
    0
    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.
     
  8. Jeffrey_Jones

    Jeffrey_Jones Second Unit

    Joined:
    Nov 6, 2001
    Messages:
    283
    Likes Received:
    0
    I could be wrong (not that familiar with PHP) but it seems to me that the following line of code...

    if ($num
     
  9. TheoGB

    TheoGB Screenwriter

    Joined:
    Jun 18, 2001
    Messages:
    1,744
    Likes Received:
    0
    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...
     
  10. JJR512

    JJR512 Supporting Actor

    Joined:
    Dec 11, 1999
    Messages:
    619
    Likes Received:
    0
    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! [​IMG]
     
  11. Frank Anderson

    Frank Anderson Cinematographer

    Joined:
    Jun 7, 1999
    Messages:
    2,667
    Likes Received:
    0
    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.
     
  12. TheoGB

    TheoGB Screenwriter

    Joined:
    Jun 18, 2001
    Messages:
    1,744
    Likes Received:
    0
    Yeah, sorry Justin - I meant to say it was in the Edit Profile bit where you enter your sig code...[​IMG]
     
  13. Billy Fife

    Billy Fife Extra

    Joined:
    Apr 7, 2002
    Messages:
    15
    Likes Received:
    0
    wow nice signature. Makes mine look so plain [​IMG]
     
  14. Parker Clack

    Parker Clack Schizophrenic Man
    Moderator

    Joined:
    Jun 30, 1997
    Messages:
    12,215
    Likes Received:
    58
    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
     
  15. JJR512

    JJR512 Supporting Actor

    Joined:
    Dec 11, 1999
    Messages:
    619
    Likes Received:
    0
    Yep, it's me! [​IMG]
    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? [​IMG]
     
  16. Jeffrey_Jones

    Jeffrey_Jones Second Unit

    Joined:
    Nov 6, 2001
    Messages:
    283
    Likes Received:
    0
     
  17. Parker Clack

    Parker Clack Schizophrenic Man
    Moderator

    Joined:
    Jun 30, 1997
    Messages:
    12,215
    Likes Received:
    58
    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
     
  18. Bill Slack

    Bill Slack Supporting Actor

    Joined:
    Mar 16, 1999
    Messages:
    837
    Likes Received:
    0
    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 http://url/cgi-bin/imageGenerator 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 [​IMG]
    Doh. My free host doesn't work though. Heh.
     
  19. JJR512

    JJR512 Supporting Actor

    Joined:
    Dec 11, 1999
    Messages:
    619
    Likes Received:
    0
    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.
     

Share This Page