I was missing EXIF support in Comoblog (more specific the ability to view which date the picture was taken) and because of that i added it to my own installation of Comoblog. Maybe you should do something similar in the official build. I use a free PHP class (http://www.phpclasses.org/browse/package/1042.html) that does most of the work. I only had to add some line of code to post_add.php and comoblog_batch.php. First of all you have to include exifReader.inc then you have to add this in both post_add.php and comoblog_batch.php:
You have to change it a little to work in post_add.php (change from the $post variable to the $image variable). Then you have to change the mysql query so that the date is saved. In the sql database you have to add a column in the image table. Add a CHAR(20) which will store the date. Some small changes in the template is req to show the date. That’s all.
Bye
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In comoblog_batch.php you should add this code just before the mysql query at line 137 (or something). In the post_add.php you should add it before the mysql query at line 108 (roughly).
/JMG
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for this. I would probably prefer to add this as a Module rather than actual core code. Can't see any problems with handling it like that from first glance.
Hi!
I was missing EXIF support in Comoblog (more specific the ability to view which date the picture was taken) and because of that i added it to my own installation of Comoblog. Maybe you should do something similar in the official build. I use a free PHP class (http://www.phpclasses.org/browse/package/1042.html) that does most of the work. I only had to add some line of code to post_add.php and comoblog_batch.php. First of all you have to include exifReader.inc then you have to add this in both post_add.php and comoblog_batch.php:
======
if ($post['images_extension'][$i] == 'jpg') {
if (!isset($er)) {
$er = new phpExifReader($post['images_tmp'][$i]);
} else {
$er->assign($post['images_tmp'][$i]);
}
$er->processFile();
unset($exifdata);
$exifdata = $er->getImageInfo();
$imagedate = $exifdata['DateTime'];
if (preg_match("/([0-9][0-9][0-9][0-9]):([0-9][0-9]):([0-9][0-9]) ([0-9][0-9]):([0-9][0-9]):([0-9][0-9])/", $imagedate) && strlen($imagedate) <= 20 ) {
$imagedate[4] = "-";
$imagedate[7] = "-";
}
else {
$imagedate = "0000-00-00 00:00:00";
}
} else $imagedate = "0000-00-00 00:00:00";
You have to change it a little to work in post_add.php (change from the $post variable to the $image variable). Then you have to change the mysql query so that the date is saved. In the sql database you have to add a column in the image table. Add a CHAR(20) which will store the date. Some small changes in the template is req to show the date. That’s all.
Bye
In comoblog_batch.php you should add this code just before the mysql query at line 137 (or something). In the post_add.php you should add it before the mysql query at line 108 (roughly).
/JMG
Thanks for this. I would probably prefer to add this as a Module rather than actual core code. Can't see any problems with handling it like that from first glance.
I've raised a RFE for it to be looked at.
https://sourceforge.net/tracker/index.php?func=detail&aid=1517303&group_id=143354&atid=755240
I've noticed some problems with the assign method so its better not to use it. The code should therefor look like this:
unset($exifdata);
unset($imagedate);
unset($er);
if ($post['images_extension'][$i] == 'jpg') {
$er = new phpExifReader($post['images_tmp'][$i]);
$er->processFile();
$exifdata = $er->getImageInfo();
$imagedate = $exifdata['DateTime'];
if (preg_match("/([0-9][0-9][0-9][0-9]):([0-9][0-9]):([0-9][0-9]) ([0-9][0-9]):([0-9][0-9]):([0-9][0-9])/", $imagedate) && strlen($imagedate) <= 20 ) {
$imagedate[4] = "-";
$imagedate[7] = "-";
}
else {
$imagedate = "0000-00-00 00:00:00";
}
} else $imagedate = "0000-00-00 00:00:00";