hi,
im trying to let users upload a profile picture of themselves on a simple website I am creating. I want the picture to be renamed to their userid number and placed in a directory containing all other profile pics, therefore I use the zend form rename filter, BUT, i can't figure out how to make it keep the original file extension:
->addFilter('Rename', '/Applications/xampp/xamppfiles/htdocs/places/web_root/img/profile/' . (int)Zend_Auth::getInstance()->getIdentity()->id);
this works fine, except it creates the file without a filename extension. Sure i could add a . '.jpg' to the end of that and it would create a jpg file but then it would also rename .gif and .png. how can i flexibly rename the filename but keep the file extension?
Thanks a lot for the help!
renaming image files
Moderator: General Moderators
Re: renaming image files
I'm not sure how to do this with just Zend code. Usually, I'd run it through getimagesize() to determine what type of file it is, then tack on the appropriate extension after renaming.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.