onlyican Posted September 7, 2006 Share Posted September 7, 2006 Hey allOPP to OOP (soz wanted to say that for ages)AnywayI was building something to check, resize and upload imagesI was doing it, then I thought, I would put each little bit into a functionSo theres a function to check the imageThere is a function to Get the new image width and heightThere is a function to Resize and upload the imageThen I looked at it, and thought I would try and make it a classTHis is my first ever classSo I dont pick up bad habbits and keep doing things wrong, I wanted to ask the brains if they could take 3 mins to check it.The phps file is herehttp://onlyican.com/class_upload_img.phpsThere is no php uploaded thereI have tested it on my local machine, and it works. It uploads the images I wantFails on the images I dont wantAny problems u can see or anything, please let me knowI think I have covered every little bit on that code Quote Link to comment Share on other sites More sharing options...
trq Posted September 7, 2006 Share Posted September 7, 2006 Just because your code is contined within a class does not mean it is OOP. Your class is fairly static and would be hard to make customizations to without going in and actually changing code.For instance your $allowed_file_types array should probably be made into a property which could then be set from outside the class, instead of being built into it. Same with wanted height and width, which by the way is a complete misuse of constants.There is plenty more we could go into, but these things might help you as a starting point. Quote Link to comment Share on other sites More sharing options...
onlyican Posted September 7, 2006 Author Share Posted September 7, 2006 ok thanksand the 2 defines was originaly outside the code, which is why they are constants, but I could't work out how to include them into the codeSame as the $allowed_file_typesSo I need to make them Properties (and the constants, variables) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.