• (cs) in reply to tim
    Anonymous:

    Anonymous:
    I'm shocked that nobody called you out on this. md5 hashes are not even remotely unique. You could end up with 2 images with the same md5 hash, even if the images are very, very different. Your code may end up on this site some day.

    Oh, I didn't know that. I thought that was kind of the point for MD5. So, a) where's the proof (mathematically), and b) what should I be doing if I want to generate a unique sum of a file?



    I've heard that some people were able to generate md5 collisions, but I don't think it's exactly trivial.
    http://eprint.iacr.org/2004/199


  • (cs) in reply to Satanicpuppy
    Satanicpuppy:
    Anonymous:
    SeekerDarksteel:
    All our data is stored on a ~25 year old database server that had gone from a nifty place to store a little bit of interesting data to a mission critical server for 10+ departments.  The way the site was set up before, there were between 2 and 8 total pages of reports on a single coil of steel.  Each time you loaded a page of the report the webserver would hit the database for the info.  Each page would take between 10 and 25 seconds to load.


    I actually found this quote more of a WTF than the original WTF. Wouldnt it make sense to replace the server with something a little more powerful...(Im tempted to suggest a 386SX but..) like a modern PC and port any apps than stay tied to something so incredibly legacy? I know Im being nieve here but ~25 YEARS is really pushing it........

    Yea, I agree. At that point it absolutely has to be easier to graft external systems onto the legacy system than try to expand the legacy system to meet modern needs. I pretty much do legacy add-ons for a living...They're never elegant...Always some new crap bolted onto some obsolete crap, with none of the clean flow you'd expect off a new system. But they get the job done.


    This should be called the organic software development life cycle. It greatly increases the lifespan of apps, but when they die, they tend to stay dead ;)
  • (cs) in reply to Pain

    I actually found this quote more of a WTF than the original WTF. Wouldnt it make sense to replace the server with something a little more powerful...(Im tempted to suggest a 386SX but..) like a modern PC and port any apps than stay tied to something so incredibly legacy? I know Im being nieve here but ~25 YEARS is really pushing it........

     

    No kidding its rediculous.  You guys would laugh your asses off at some of the stuff that happens around here.  Hell, the mainframes running the mill Im at were built in 1982.  We actually are upgrading the database server soon.  We have the server (Interesting story behind that coming up right after this), but a potential labor strike in the near future has kept us from replacing it as we have other things that need to be dealt wtih now.  Unfortunately they decided to purchase an Itanium server, I still have no idea why, but at least it should be fast. 

     

    So anyway, here is the story behind the new server:

    The server was scheduled to be delivered last summer.  When it finally arrived, the truck driver parked at shipping and receiving.  He got out of the truck, untied the box, and went inside to ask where they wanted the box.  He was informed that he had to take it to process control headquarters.  Ok, no problem, the guy jumps back in his truck and heads off on his way.

    Cut to the process control office in my section (not the main office).  My boss receives a phone call as I am standing in his office talking to him.  I overhear the following:

    My Boss: "Dave Jones."

    Guy:  "You work for Bob Smith?"

    Dave:  "What?  Who is this?"

    Guy: "You work for Bob Smith?"

    Dave:  "Uh, yeah, why?"

    Guy: "Well there's a package here for him and we can't get ahold of him."

    Dave: "Uuh....ok.  Where is it?"

    Guy: "Sitting in the middle of the road."

     

    Turns out the driver had never resecured the server box before leaving shipping and receiving.  It ended up falling off the truck and was smashed beyond use and had to be returned.  The best part is, no one knows what the hell the driver did after he lost his package.  He just disappeared.

  • AnonymousE (unregistered) in reply to Joe

    Your retarded, an animated GIF is an image file with the animation details embedded, it would be exactly the same. You sure you didn't write this code?

    -!!!

  • tweakt (unregistered) in reply to AnonymousE

    A much cooler approach:

    <IMG
    SRC="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
    AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
    ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
    a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
    ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
    F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
    hhx4dbgYKAAA7"
    ALT="Larry">

  • (cs) in reply to kirinyaga
    Anonymous:
    the chances to get a collision a pretty small, but never use any hash algorithm without being prepared for a collision, because it just can happen. I've seen a lot with weak algos like CRC, and none yet with MD5, but it WILL happen, it is just a matter of time. Now, your app in particular doesn't sound that critical that you have to worry about hash collisions. But if you are generating a lot of hashs (say at the per second level) and/or a collision could really hurt your application, you HAVE to take it into account. Here the only thing you have to worry about is you might one day lose an old image (and you will probably never lose another one after that) : not such a big deal.


    OK let's do a bit of reasonable-ness checking on your statement, shall we?
    NOTE: my statistics knowledge is a bit rusty at this point, but I think the concept is fairly valid.  =)

    First, let's pretend that:
    A) you aren't attacking md5 intentionnaly to find collisions, and
    B) that it really does use all 2^128 possible hash values with approximately uniform distribution.

    There are **roughly** 2^32 seconds in 100 years, or thereabouts, right?

    Saving a random image (read: random output hash from MD5) once per second for 2^32 s ~ 100 years, is a specific instance of the generalized birthday paradox:
    http://www.answers.com/topic/birthday-paradox

    Specifically, there are N=2^128 possible numbers (hashes) to choose from, and there are n=2^32 pictures choosing their hash from that larger set. 

    Therefore, the chance that there is at least 1 duplicately chosen value is approximately:

    1 - 1 / ( e^ ( 2^64 / 2^129 ) ) ~=~ 0.0

    According to my estimate, to have a probability of 1/2 of choosing 2 duplicate MD5 hashes, according to the constraints I gave above, you would need to save images once per second for SQRT( 2^129 * ln 2 ) seconds, or about 21,719,381,355,163,562,491 seconds ~=~ 7 billion years.

    This to have a 50% chance of collision.

         -dave-



  • (cs) in reply to SeekerDarksteel

    SeekerDarksteel:
    The best part is, no one knows what the hell the driver did after he lost his package.

    Wow, that would be a great sound-bite to take out of context...

  • (cs) in reply to asdf
    Anonymous:

    Ah, the power of porn. I've made a similar PHP script that goes sequentially through a set of images.  For example, if your images are in the format "http://www.somesite.com/images/imgXXXXb.jpg" you have to manually parse it out to be in three parts: "http://www.somesite.com/images/img", the number of digits in the number (in this case, 4), and "b.jpg".  It then outputs all of the images in a range you specify.  It's quite clever, runs fast (since it's simple and runs on my local machine), and saves a lot of time since you don't have to change the URL to get to the next image.

    <font size="4">T</font>hat sounds like http://aninaked.com; not that I had anything to do with that bit of  code.

  • (cs) in reply to SeekerDarksteel
    SeekerDarksteel:
    Unfortunately they decided to purchase an Itanium server, I still have no idea why, but at least it should be fast.


    Sorry, I couldnt stop laughing after I read that line (Which I had a ROTFLMAO emoticon for use here)! Why do i suspect you have a VAX there?

    From the rest of your story it sounds like you truly you are operating under the curse of the Itanic *grin*
  • Lunkwiill (unregistered) in reply to David
    Anonymous:
    The real WTF is that they should have stored the images in XML.

    Oh yeah.
    <image>
      <size><x value="2"/><y value="2"/></size>
      <row>
        <pixel>
           <!-- a lovely pink -->
          <red value="dHdvIGh1bmRyZWQgYW5kIGZpZnR5LWZpdmU=">
          <green value="emVybw==">
          <blue value="b25lIGh1bmRyZWQgYW5kIHR3ZW50eS1laWdodA==">
        </pixel>
        <!-- ... -->
      </row>
    </image>
    Everybody's stomach on the floor? OK, I realize there are some design flaws in this schema. Such as not using namespaces.
  • (cs) in reply to Pain

    Haha, yeah, our database server is indeed a VAX.  Other parts of the plant use VAX to control their areas, but the computers controlling our mill are Modcomps... if anyone knows what the hell they are. 

  • (cs) in reply to SeekerDarksteel
    SeekerDarksteel:
    Haha, yeah, our database server is indeed a VAX.  Other parts of the plant use VAX to control their areas, but the computers controlling our mill are Modcomps... if anyone knows what the hell they are. 


    Congratulations! It sounds as if youre about to embark on an adventre, porting your legacy apps to openVMS (hence the Itanic purchase). Im in a state of shock just thinking about it....anyways if you ever get lumped with trying to get some spare parts for your MODCOMPs I hear NASA might have some bits and pieces...
  • Jeremiah Blatz (unregistered)

    Just FYI, there is one, and exactly one acceptable use of this technique: print(base_64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="); exit();

    That's a transparent 1x1 gif, BTW.

  • ChiefCrazyTalk (unregistered)

    I once worked for a company that embedded all of their images in a flat file that way - the reason was so they could print everything out and copywrite all the pages of the source code, including images.  Not sure if that was the thinking here, but there could be some other reason we don't know about.

  • (cs) in reply to ChiefCrazyTalk
    Anonymous:
    I once worked for a company that embedded all of their images in a flat file that way - the reason was so they could print everything out and copywrite all the pages of the source code, including images.


    I don't think such a hardcopy would be of much use to a copywriter. I lean towards thinking that you meant to say "copyright", but that doesn't make any sense either, unless this was in the days before the Berne convention in one of those places where you had to jump though hoops to obtain copyright. And even then, you have to wonder what the $@!# those people were smoking.

  • Sanjay (unregistered) in reply to Gene Wirchenko

    Gene Wirchenko:
    Alex Papadimoulis:
    Shortly after taking a new job, Graham noticed that his new colleagues had a rather peculiar metric for determining software quality: cleverness. The standard measurements of cost, performance, maintainability, and so on, were afterthoughts -- nay, hindrances -- to their vision. Oh no, they were special, and so would be the software that they developed.


    The software industry has many clever people.  It also has many smart people.  These are not the same.  <SIGH>

    Sincerely,

    Gene Wirchenko

    Hilarity has officially ensued.

  • (cs) in reply to Jeremiah Blatz
    Anonymous:
    Just FYI, there is one, and exactly one acceptable use of this technique: print(base_64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="); exit();

    That's a transparent 1x1 gif, BTW.



    It looks like it's screaming while drowning in a container of boiling oil.

  • PHP Guruwannabe (unregistered) in reply to tim

    Two methods of improving your PHP-script

    1. If you are using a database to hold the metadata about a file, just create a record and use whatever methods the database has to create a unique key. Save the filename using the key as input.

    2. http://no2.php.net/manual/en/function.tempnam.php

  • (cs) in reply to Jeremiah Blatz

    Anonymous:
    Just FYI, there is one, and exactly one acceptable use of this technique: print(base_64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="); exit(); That's a transparent 1x1 gif, BTW.

    What in the world makes that acceptable? Lazy web page designers who can't be bothered to learn CSS properly?

    That sort of thing was a WTF back when it was still being used, and even more so nowadays.

     

  • pilot (unregistered) in reply to phearlez

    ??????! ??? ?????????!!!!

    ??\??!

    ???.

  • (cs) in reply to Jeremiah Blatz
    Anonymous:
    Just FYI, there is one, and exactly one acceptable use of this technique: print(base_64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="); exit();

    That's a transparent 1x1 gif, BTW.

    How the hell can using 1x1 transparent gifs in 2006 be considered acceptable?

  • Randolpho (unregistered) in reply to masklinn
    masklinn:
    Anonymous:
    Just FYI, there is one, and exactly one acceptable use of this technique: print(base_64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="); exit(); That's a transparent 1x1 gif, BTW.

    How the hell can using 1x1 transparent gifs in 2006 be considered acceptable?

     

    For that .000000000000001% of potential visitors still using Netscape 4.0?

  • Paul (unregistered) in reply to David

    I don't see the problem, - I heard Flickr works like this

    ;)

    Seriously, this is the first PHP WTF I've seen that has almost caused me a mental seizure.

  • (cs) in reply to Jeremiah Blatz

    Anonymous:
    Just FYI, there is one, and exactly one acceptable use of this technique: print(base_64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="); exit(); That's a transparent 1x1 gif, BTW.

    Well done. probably the most useful contribution to this thread.

  • (cs) in reply to Randolpho
    Anonymous:
    masklinn:
    Anonymous:
    Just FYI, there is one, and exactly one acceptable use of this technique: print(base_64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="); exit(); That's a transparent 1x1 gif, BTW.

    How the hell can using 1x1 transparent gifs in 2006 be considered acceptable?

     

    For that .000000000000001% of potential visitors still using Netscape 4.0?



    That woud amount to 0.0001 person, assuming the entire population of the earth visits the site.

    Geeze, man. Get your facts straight.
  • steven_walsh (unregistered) in reply to Sean
    Sean:
    frosty:
    Anonymous:
    /**********************
    __images.php__

    Displays an embedded image file

    (C) Initech Solutions, 2001
    **********************/



    Is this the same Initech from "Office Space"?


    Yes.  Alex used to work there.  He was the guy who had his stapler taken away.


    O RLY?  I think he was my cube neighbor.


    YA RLY!!!
  • Kawahee (unregistered)

    OMG

    If you visit http://initech.co.uk/, their homepage says "Don't put all your eggs in one basket? With an initech solution, you can!"

  • (cs) in reply to Kawahee
    Anonymous:
    OMG

    If you visit http://initech.co.uk/, their homepage says "Don't put all your eggs in one basket? With an initech solution, you can!"

    They are not consistent about following that.  Their home page displays the date and time.  It is updated to the second.  This is even more functionality than my taskbar display.

    Sincerely,

    Gene Wirchenko

  • dreeam.scape (unregistered)

    For those that don't know, the PHP language itself has images embedded in it... some PHP & Zend images, like logos, and a few easter eggs.

    If you make a PHP application that has some images you do not want people changing, like your logo, icons, etc, then you're forced to come up with some kind of solution, like embedding those images directly in a part of the script that will later be compiled/encoded with ion, Zend, or SG, so that the images may be retrieved but not changed.

  • Phi Tran (unregistered)

    WE HAVE THEM WORKED.....in IE

    without the PhP roundtrip. (If you do that then  collisionworry become N/A)


    There is an othe avenue to have them implemented in IE/ The tool that we have is a javascript library that encode/decode create/translate XBM, BMP and PNG graphic file format - 100% at client side. With that luxury we use the following road map to have image displayed in IE.

    -Create multiple XBM files. Each have with as the background as black fore ground as whte  represent only one color or an array of color .- See the following notes.

    -Place them in the src of the Img elements. each one on top of the other. We take advantage of t he fact that IE treat XBM as one one color bitmap . The other color is transparent.

    Using MS mask filter to have the background transparent and the foreground to the mask color of your choice. You can furher use Alpha and/or Gradient to have one XBM to display the ARRAY OF COLOR as well. It can be applied it either foreground or background image.or both . . . . Depend on how you place, the how many filter , and the order of those filters in the style/stylesheet attribute

    WE HAVE THEM WORKED.....
    Sorry:For fair business practice and for the vast amount of investment that we have put in our tools  We are unable to have them post as a public domain property. If you need further information you can drop me a line at: E P H I T R A N @ G M A I L . C O M. ( I am a consultant living in Houston, Texas - Near Home of the Texas Longhorn).


    Many thanks.

    Phi.

    Note:I have put notes on 'As the day pass by' and the 'Base64 for the IE of Dean. That discuss more about the Pros and Cons of many methode that we have them tested. and result. ( See them if you need further info)

  • Your Name (unregistered)

    Oh no, they were special

    True, they were Very Special coders indeed.

  • (cs) in reply to nikolas
    Anonymous:
    i would have extended the script to accept image uploads and include them via self-modification  =D


    Genius!
  • Chris Reeder (unregistered)

    Did you guys happen to know there actually is a http://www.StupidProgrammer.com? I run the site and I would greatly appreciate it if you would not reference your_mom_naked.gif and my site in the same sentence. I do not run that type of site. :-)

    Thanks!! Chris Reeder StupidProgrammer.com

  • Barbie (unregistered)

    There's actually nothing wrong with this. The program is going to be embedding images in email (kind of obvious if you've done this in the past).

    Better to have the image data already encoded into strings than to have to load each image file and convert it to base64 for each email you want to send - especially if you're sending 1,000 emails at a time.

    The real WTF is everyone who's commented so far and assumed that there couldn't possibly be a valid reason, and never stopped to wonder how images get embedded in the emails they receive every day, without needing external references.

  • (nodebb)

    thanks for info

    Addendum 2022-10-30 22:22: I can advise you on where to look for texts of the best quality in almost any language nowadays. I've found specialists from this link who are capable of performing precisely that, therefore I strongly advise you to thoroughly review and read them. They've helped me multiple times, and I'm grateful for it.

Leave a comment on “Imaging In Line”

Log In or post as a guest

Replying to comment #:

« Return to Article