Welcome Guest, Not a member yet? Register   Sign In
Code Question
#2

Hi,

You should check it has been set before generating a URL with it.

I would have made this into a helper. If called I would return simply either TRUE or FALSE if resized image was created. I would also have put the location of the image either as a config item, or an option in the method.

Within this helper I would also have another function called something like 'show_image', which checks that the image exists, and returns a url to it. But, not the base_url bit, that part is for the view to add. If it did not exist, it could then call the function above to create the image as a private function.

I also always follow the naming convention of adding _model, _view, _helper to the end of my class names. So your model here would be Image_resize_model.php
However, that is all opinion, as naming conventions are not enforced, and the beauty of CI is you can do it however you want.

Good job though,

Paul.
Reply


Messages In This Thread
Code Question - by wolfgang1983 - 06-20-2016, 12:24 AM
RE: Code Question - by PaulD - 06-20-2016, 09:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB