diff options
Diffstat (limited to 'include/photo/photo_driver.php')
-rw-r--r-- | include/photo/photo_driver.php | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 5d61556ab..553e77ed1 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -238,10 +238,12 @@ abstract class photo_driver { if(! $this->is_valid()) return FALSE; + if((! function_exists('exif_read_data')) || ($this->getType() !== 'image/jpeg')) return; $exif = @exif_read_data($filename,null,true); + if($exif) { $ort = $exif['IFD0']['Orientation']; @@ -281,7 +283,6 @@ abstract class photo_driver { break; } - // logger('exif: ' . print_r($exif,true)); return $exif; } @@ -302,7 +303,6 @@ abstract class photo_driver { $p['filename'] = (($arr['filename']) ? $arr['filename'] : ''); $p['album'] = (($arr['album']) ? $arr['album'] : ''); $p['scale'] = ((intval($arr['scale'])) ? intval($arr['scale']) : 0); - $p['photo_flags'] = ((intval($arr['photo_flags'])) ? intval($arr['photo_flags']) : 0); $p['allow_cid'] = (($arr['allow_cid']) ? $arr['allow_cid'] : ''); $p['allow_gid'] = (($arr['allow_gid']) ? $arr['allow_gid'] : ''); $p['deny_cid'] = (($arr['deny_cid']) ? $arr['deny_cid'] : ''); @@ -311,12 +311,12 @@ abstract class photo_driver { $p['edited'] = (($arr['edited']) ? $arr['edited'] : $p['created']); $p['title'] = (($arr['title']) ? $arr['title'] : ''); $p['description'] = (($arr['description']) ? $arr['description'] : ''); + $p['photo_usage'] = intval($arr['photo_usage']); + $p['os_storage'] = intval($arr['os_storage']); + $p['os_path'] = $arr['os_path']; - // 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. - - $p['profile'] = (($p['photo_flags'] & PHOTO_PROFILE) ? 1 : 0); - + if(! intval($p['scale'])) + logger('save: ' . print_r($arr,true)); $x = q("select id from photo where resource_id = '%s' and uid = %d and xchan = '%s' and `scale` = %d limit 1", dbesc($p['resource_id']), @@ -338,10 +338,10 @@ abstract class photo_driver { `height` = %d, `width` = %d, `data` = '%s', + `os_storage` = %d, `size` = %d, `scale` = %d, - `profile` = %d, - `photo_flags` = %d, + `photo_usage` = %d, `title` = '%s', `description` = '%s', `allow_cid` = '%s', @@ -361,11 +361,11 @@ abstract class photo_driver { dbesc($p['album']), intval($this->getHeight()), intval($this->getWidth()), - dbescbin($this->imageString()), + (intval($p['os_storage']) ? dbesc($p['os_path']) : dbescbin($this->imageString())), + intval($p['os_storage']), intval(strlen($this->imageString())), intval($p['scale']), - intval($p['profile']), - intval($p['photo_flags']), + intval($p['photo_usage']), dbesc($p['title']), dbesc($p['description']), dbesc($p['allow_cid']), @@ -377,7 +377,7 @@ abstract class photo_driver { } else { $r = q("INSERT INTO `photo` - ( `aid`, `uid`, `xchan`, `resource_id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `size`, `scale`, `profile`, `photo_flags`, `title`, `description`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` ) + ( `aid`, `uid`, `xchan`, `resource_id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `os_storage`, `size`, `scale`, `photo_usage`, `title`, `description`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` ) VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s' )", intval($p['aid']), intval($p['uid']), @@ -390,11 +390,11 @@ abstract class photo_driver { dbesc($p['album']), intval($this->getHeight()), intval($this->getWidth()), - dbescbin($this->imageString()), + (intval($p['os_storage']) ? dbesc($p['os_path']) : dbescbin($this->imageString())), + intval($p['os_storage']), intval(strlen($this->imageString())), intval($p['scale']), - intval($p['profile']), - intval($p['photo_flags']), + intval($p['photo_usage']), dbesc($p['title']), dbesc($p['description']), dbesc($p['allow_cid']), @@ -406,7 +406,7 @@ abstract class photo_driver { return $r; } - public function store($aid, $uid, $xchan, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') { + public function store($aid, $uid, $xchan, $rid, $filename, $album, $scale, $usage = PHOTO_NORMAL, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') { $x = q("select id from photo where `resource_id` = '%s' and uid = %d and `xchan` = '%s' and `scale` = %d limit 1", dbesc($rid), @@ -430,7 +430,7 @@ abstract class photo_driver { `data` = '%s', `size` = %d, `scale` = %d, - `profile` = %d, + `photo_usage` = %d, `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', @@ -451,7 +451,7 @@ abstract class photo_driver { dbescbin($this->imageString()), intval(strlen($this->imageString())), intval($scale), - intval($profile), + intval($photo_usage), dbesc($allow_cid), dbesc($allow_gid), dbesc($deny_cid), @@ -461,7 +461,7 @@ abstract class photo_driver { } else { $r = q("INSERT INTO `photo` - ( `aid`, `uid`, `xchan`, `resource_id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `size`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` ) + ( `aid`, `uid`, `xchan`, `resource_id`, `created`, `edited`, `filename`, type, `album`, `height`, `width`, `data`, `size`, `scale`, `photo_usage`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` ) VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s' )", intval($aid), intval($uid), @@ -477,7 +477,7 @@ abstract class photo_driver { dbescbin($this->imageString()), intval(strlen($this->imageString())), intval($scale), - intval($profile), + intval($photo_usage), dbesc($allow_cid), dbesc($allow_gid), dbesc($deny_cid), @@ -569,7 +569,7 @@ function import_profile_photo($photo,$xchan,$thing = false) { if($thing) $hash = photo_new_resource(); else { - $r = q("select resource_id from photo where xchan = '%s' and (photo_flags & %d )>0 and scale = 4 limit 1", + $r = q("select resource_id from photo where xchan = '%s' and photo_usage = %d and scale = 4 limit 1", dbesc($xchan), intval(PHOTO_XCHAN) ); @@ -622,7 +622,7 @@ function import_profile_photo($photo,$xchan,$thing = false) { else $photo_failure = true; - $p = array('xchan' => $xchan,'resource_id' => $hash, 'filename' => basename($photo), 'album' => $album, 'photo_flags' => $flags, 'scale' => 4); + $p = array('xchan' => $xchan,'resource_id' => $hash, 'filename' => basename($photo), 'album' => $album, 'photo_usage' => $flags, 'scale' => 4); $r = $img->save($p); @@ -684,7 +684,7 @@ function import_channel_photo($photo,$type,$aid,$uid) { $img->scaleImageSquare(300); - $p = array('aid' => $aid, 'uid' => $uid, 'resource_id' => $hash, 'filename' => $filename, 'album' => t('Profile Photos'), 'photo_flags' => PHOTO_PROFILE, 'scale' => 4); + $p = array('aid' => $aid, 'uid' => $uid, 'resource_id' => $hash, 'filename' => $filename, 'album' => t('Profile Photos'), 'photo_usage' => PHOTO_PROFILE, 'scale' => 4); $r = $img->save($p); |