List Info

Thread: note 69992 added to function.image-type-to-extension




note 69992 added to function.image-type-to-extension
user name
2006-09-29 02:55:10
2006-09-29

A few notes about some contributions on this page.

1. It seemed to me that on the face it of all of the
offerings to emulate "image_type_to_extension"
function fell short of the mark in one way or another (See
my comments below). That's why I wrote my own and submitted
to this page below. In respect of my work any comments, bugs
noted or improvements would be gratefully received.

2. Avoid using the Switch statement in an unconventional
method to "Break" (I note the use of the return
statement!). Also even if it does nothing at the inception
of our code - Still put in the default case (It lets others
realise that a default is not required or at worst
forgotton.

3. In an environment that is under your control the risk of
an error by determining the content by its extension or MIME
type may seem an attractive solution to a problem. However,
in the real world there's no guarantee that a MIME type or
file extension is correct for it's associated file.

Consider using functions to get the image type:
      getimagesize or (This is available without GD)
      exif_imagetype

4. There's more to coding than just putting something
together to do a job!!! But whatever is done is worthwhile -
Hence expletives have no place in this forum!! 

5. The idea from "oridan at hotmail dot com" is a
very slick idea. I will be taking a closer look at this for
my own project.
----
Server IP: 83.138.144.80
Probable Submitter: 86.142.241.158
----
Manual Page -- http://www.php.net/manual/en/function.image-typ
e-to-extension.php
Edit        -- https://master
.php.net/note/edit/69992
Del: integrated  -- h
ttps://master.php.net/note/delete/69992/integrated
Del: useless     -- http
s://master.php.net/note/delete/69992/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/69992/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/69992/spam
Del: non-english -- 
https://master.php.net/note/delete/69992/non-english
Del: in docs     -- http
s://master.php.net/note/delete/69992/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/69992
Reject      -- https://mast
er.php.net/note/reject/69992
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )