| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 72964 | 2006-10-02 20:35:00 | Where find your IP address?! | stuffed (1469) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 488631 | 2006-10-03 05:55:00 | Fancy, and yet it still says "your" instead of "you're". So not THAT fancy :xmouth: But "you're" means "you are" while "your" is the posessive case of you, meaning belonging to you So I am perplexed by "your" understanding that the code is wrong. You would not say "You are IP is xxx.xxx.xxx.xxx" You would say "Your IP is ...." Or have I missed something here...? |
godfather (25) | ||
| 488632 | 2006-10-05 20:04:00 | But "you're" means "you are" while "your" is the posessive case of you, meaning belonging to you So I am perplexed by "your" understanding that the code is wrong. You would not say "You are IP is xxx.xxx.xxx.xxx" You would say "Your IP is ...." Or have I missed something here...? Quoting directly from the generated image (www.danasoft.com): Your IP is xxx.xxx.xxx.xxx! Your ISP is xxxxxxxxxxxx.net! You are running on Windows XP and using Firefox! Smile your on camera |
pixeldust (6619) | ||
| 488633 | 2006-10-05 20:39:00 | Ah, so I was right! I did miss something there... Ooops |
godfather (25) | ||
| 488634 | 2006-10-06 00:08:00 | It's simply a script inserted in the page. The page he links to is just a fancy way of displaying it within an image. Here's how (www.allscoop.com). I'd forgotten how much I dislike PHP. It completely lacks structure, tacking all sorts of features into the core distribution without regard for organisation. Here's the equivalent code on Ruby: require 'cgi' # Rubygems is only required if RMagick is installed as a gem require 'rubygems' require 'RMagick' cgi = CGI.new WIDTH = 275 HEIGHT = 25 canvas = Magick::Image.new(WIDTH, HEIGHT) { self.background_color = "#666699" self.format = "PNG" } drawing = Magick::Draw.new # Set font parameters drawing.pointsize 14 drawing.stroke "white" drawing.fill "white" drawing.text_align Magick::CenterAlign # Draw text. The 3 extra pixels of height adjust for font size (the reference point is not quite the top left) drawing.text WIDTH / 2, HEIGHT / 2 + 3, "Your IP is #{ENV["REMOTE_ADDR"]}" # Draw on canvas drawing.draw(canvas) cgi.out("Content-type" => "image/png") do # Spit the image out in binary form canvas.to_blob end I realise this is much longer than the PHP equivalent, but it involves loading only the components we need, involves significant commentary and doesn't involve magic numbers or mysterious variables that are only ever fed back into another function. |
TGoddard (7263) | ||
| 1 2 | |||||