Hi all.
TIA for answering.
I'm having a problem with an image creation function.
Here's my code:
if(eregi("[pjpeg|jpeg|jpg]", $full_img[1])){
$path = "$upload_adFullimg_dir/$id" . "" . basename($FILES['adFullimg']['name']);
$src_image = imagecreatefromjpeg($path);
}
else if(eregi("[png|x-png]", $full_img[1])) {
$path = "$upload_adFullimg_dir/$id" . "" . basename($FILES['adFullimg']['name']);
$src_image = imagecreatefrompng($path);
}
- $id is just an integer I assign. I know it is working since jpeg's run through this code just fine.
But, when I test with a file of type "image/x-png", I'm somehow matching on the initial if statement and running imagecreatefromjpeg(). I know this because PHP returns an error for imagecreatefromjpeg.
I really think it is in my pattern match, but I can't figure it out. I've looked on the Web for a good explanation of syntax for pattern matching, but I can't find anything that doesn't make a lot of assumptions about the reader's level of expertise with regular expressions.
Any help would be appreciated!