Jump to content

Archived

This topic is now archived and is closed to further replies.

onlyican

Big Favour, Checking a class

Recommended Posts

Hey all
OPP to OOP
(soz wanted to say that for ages)

Anyway
I was building something to check, resize and upload images

I was doing it, then I thought, I would put each little bit into a function
So theres a function to check the image
There is a function to Get the new image width and height
There is a function to Resize and upload the image

Then I looked at it, and thought I would try and make it a class
THis is my first ever class
So 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 here
http://onlyican.com/class_upload_img.phps
There is no php uploaded there

I have tested it on my local machine, and it works. It uploads the images I want
Fails on the images I dont want

Any problems u can see or anything, please let me know

I think I have covered every little bit on that code

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
ok thanks
and 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 code
Same as the $allowed_file_types

So I need to make them Properties (and the constants, variables)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.