I am trying to create a image upload site, where users can upload an image to the site. Which is the easiest possible way to do this without using any plugin. How do you get exif/meta information from the image?
Asked
Active
Viewed 443 times
2
-
"simple" and "without using a plugin" is a bit contradictory. The simplest way is to use a plugin! I use MeioUpload - it's very simple; https://github.com/jrbasso/MeioUpload – joshua.paling Sep 11 '12 at 23:26
-
1And for info on exif data, there's a lot of info around on how to do this, and it's pretty easy. eg. $exif = exif_read_data($filename); If you're wanting to rotate based on exif data, start with checking this question: http://stackoverflow.com/questions/3657023/how-to-detect-shot-angle-of-photo-and-auto-rotate-for-website-display-like-desk – joshua.paling Sep 12 '12 at 00:28
1 Answers
2
Specify you form type to be file.
$this->Form->create('Model', array('type' => 'file'));
$this->Form->input('filefield', array('type' => 'file'));
in you before save see the output of fielfield, it will contain the $_FILE like information, having all tmp-name, original filename and error code.
you can urself move_uploaded_files() to your convenient location. Store the filename into your table.
But, for the implementation you will have to deal with various things like two filenames having same name, file size, extensions allowed, permissions. Delete files when records get deleted.
So, for learning purposes u can try this out but for production mode it'd be better if you stick to a plugin.

Kishor Kundan
- 3,135
- 1
- 23
- 30