Right, so I am actually working on something. I will not tell you what I am working on, but it is a website, if it is not that obvious. Powered by PHP, a language I was ranting about (I was ranting to myself) for about an hour before quiting and heading to my living room to watch Family Guy.

It went like this: have you ever, doesn’t matter which language, made major and enormous modifications to the source since the last time you actually ran it? I do that a lot. When I’m writing Python, it’s not a big deal because not only does it have a wonderful exception system, but I’m always happy no matter the situation as long as I’m working with Python. Why is that? I love Python. It’s the greatest language that I’ve ever worked with, even if I did nothing but a bunch of file management. What happens when I modify a large portion of the source code and the language is PHP? That’s an entirely different story.

Let me bring you up to speed: in the first stages of my works, I’m always sloppy: files are everywhere, very few folders and hardly any organization. In fact, I would usually have around 7 files all doing different things and only the root folder to hold them in (unless it’s Python – I’m super organized with that). Mind you, they each have at least 4kb of data and this is usually the first hour in. As you can guess, as the days pass, things get beyond manageable unless I was to write everything I do onto a piece of paper. My mind isn’t concentrating on what I’m doing, but more so where I put what where. My mind and source become a pile of yucky spaghetti. Spaghetti that’s yucky. I like spaghetti.

So, after I decide that I’m ready, the self-proclaimed Age of Organization and Mass Tank Production begins. I begin classifying the files into folders, all based on what they do. I then create the core file that determines what is loaded and when. The last time I did this, I had a total of 9 folders and 16 files, not including the mySQL files and self-proclaimed prototypes. Not much, I know. Start small, end big?

Moving along. The only way I can upload all these folders and files in 10 seconds is through a zip file (also known as a compressed file). So, I do that. I upload and then extract. This is when the strange events start happening. In my source, I have a form and a bunch of functions that allow the user (you) to upload images and a bunch of other cool-but-unfinished-shit. Let me explain a little more: the result is either 3 images or 2 images. 1 image is the one that the user (you) uploaded, and another is a thumbnail (resized copy, usually very small compared to the real thing) of that image. The third is another resized, but only if the original is too large (who resizes images through XHTML/HTML, huh?).

The strange thing is, that third image always came out crappy. After many hypothesis, I had determined that the script was either resizing the image to be smaller and then making it bigger, or it was copying the thumbnail and then making it bigger. I spent up towards to one hour trying to figure out the problem. I then concluded that PHP was either retarded, poorly coded, or that the world is going insane. This is the part where I go and watch Family Guy.

After I returned, I tied to solve the mystery of the fucking-image-that-turned-into-a-pile-of-resized-crap. For some reason, I went into the index file (the file whose name is index) and discovered something shocking: the require were pointing to an old variant of the file that handles the image uploads! In other words, I thought the problem was in the newer variant when in reality it wasn’t even being used! The moral of the story is basically this: ALWAYS, ALWAYS, delete every single file and folder in the directory that you’re uploading your zip to. OR, double check everything in the file before uploading it!