Strict Standards: Only variables should be passed by reference in
It is strange error (first time I've evern seen this kind of notice)
so i've looked over internet and i've found nothing so far...
here is the code that is causing it:
See the manual page for end(), and notice in the description section that the array argument is passed by reference (indicated by the "&"). In your code you are passing the result of explode(), which while it is an array (assuming it succeeds), there is no variable to pass as a reference. Therefore, you need an intermediate step to create an array variable (and ideally should verify it is, in fact, a successful assignment before assuming it's okay):
PHP Code:
$name = basename(strtolower($src));
$exploded = explode(".", $name);
if($exploded === false) { throw new Exception("Oops!"); } // or whatever you want to do
$F = end(exploded));
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
PS: Personally, I'd probably use getimagesize() to figure out what type of image it is.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Well i toke your advice,and your code , but now it's not "Strik Standards" it's Fatal error with same infonly variables should be passed at....
it's at the same line
Code:
$F = end(exploded));
:S
actually it worked ,just had to add the $ symbol and remove one )
ty , problem solved!
using strtolower is a good idea while checking for file extensions in case if extension is JPG or jPg etc...
Another reason I like getimagesize(), as it looks at the actual file contents, not whatever name a user happened to assign to it.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks