Welcome Guest, Not a member yet? Register   Sign In
How do I make multiple thumbails for the same image with image_lib?

Calling clear() before initialize() makes sense but is imho the ugly hack. You could as well do away with the whole class all the methods just functions stuck in a file, together with a bunch of variables in the global namespace. You probably gain performance and the functionality wouldn't differ from what's available now, only difference would be the pseudo-namespace achieved by using a class. An image or an email for that matter is a perfect example of a place where not to implement a singleton, after all, one might use more than one image in an application. Reusing the same object but clearing its data whenever you need a new image is awkward. I have argued before to allow loading without instantiation and in these cases that would be better code. Two images, two objects of the same Image class. A class should represent an objects characteristics (properties such as width, height etc.) and the stuff you can do with the object (the methods, resize, crop etc) Images are the perfect place to implement oop for and not stick to procedural code with oop syntax.

From my reading of the code (can't test it here right now), new instances are possible after the first loading of the class and I would strongly recommend that.

Messages In This Thread
How do I make multiple thumbails for the same image with image_lib? - by El Forum - 07-20-2008, 04:45 PM

Theme © iAndrew 2016 - Forum software by © MyBB