provide a way to preserve photo timestamps when importing (rather than uploading)

This commit is contained in:
friendica 2014-08-12 21:51:32 -07:00
parent da982c6c9f
commit 041aff36b7
3 changed files with 13 additions and 4 deletions

View file

@ -287,6 +287,8 @@ abstract class photo_driver {
$p['allow_gid'] = (($arr['allow_gid']) ? $arr['allow_gid'] : '');
$p['deny_cid'] = (($arr['deny_cid']) ? $arr['deny_cid'] : '');
$p['deny_gid'] = (($arr['deny_gid']) ? $arr['deny_gid'] : '');
$p['created'] = (($arr['created']) ? $arr['created'] : datetime_convert());
$p['edited'] = (($arr['edited']) ? $arr['edited'] : $p['created']);
// temporary until we get rid of photo['profile'] and just use photo['photo_flags']
// but this will require updating all existing photos in the DB.
@ -328,8 +330,8 @@ abstract class photo_driver {
intval($p['uid']),
dbesc($p['xchan']),
dbesc($p['resource_id']),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($p['created']),
dbesc($p['edited']),
dbesc(basename($p['filename'])),
dbesc($this->getType()),
dbesc($p['album']),
@ -355,8 +357,8 @@ abstract class photo_driver {
intval($p['uid']),
dbesc($p['xchan']),
dbesc($p['resource_id']),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($p['created']),
dbesc($p['edited']),
dbesc(basename($p['filename'])),
dbesc($this->getType()),
dbesc($p['album']),

View file

@ -171,6 +171,11 @@ function photo_upload($channel, $observer, $args) {
'allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow,
'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny
);
if($args['created'])
$p['created'] = $args['created'];
if($args['edited'])
$p['edited'] = $args['edited'];
$r1 = $ph->save($p);
if(! $r1)

View file

@ -47,6 +47,8 @@ $cookies = 'store/[data]/frphoto_cookie_' . $channel_address;
$args['scale'] = $j['scale'];
$args['album'] = $j['album'];
$args['not_visible'] = 1;
$args['created'] = $j['created'];
$args['edited'] = $j['edited'];
if($j['allow_cid'] || $j['allow_gid'] || $j['deny_cid'] || $j['deny_gid'])
$args['contact_allow'] = $channel['channel_hash'];