X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FPhoto.php;h=4d02b5c651206359d565598b193057924ba92a74;hb=533e215a9636888675fc89f92eb9d556db180f1e;hp=707b0de5d8c3af8ea8ac849690ad644fb8180fae;hpb=b3fa03d3b4175b565ae7ed9106cb83c43801b558;p=friendica.git diff --git a/include/Photo.php b/include/Photo.php index 707b0de5d8..4d02b5c651 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -185,11 +185,20 @@ class Photo { public function store($uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') { + $r = q("select `guid` from photo where `resource-id` = '%s' and `guid` != '' limit 1", + dbesc($rid) + ); + if(count($r)) + $guid = $r[0]['guid']; + else + $guid = get_guid(); + $r = q("INSERT INTO `photo` - ( `uid`, `contact-id`, `resource-id`, `created`, `edited`, `filename`, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` ) - VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )", + ( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` ) + VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )", intval($uid), intval($cid), + dbesc($guid), dbesc($rid), dbesc(datetime_convert()), dbesc(datetime_convert()), @@ -230,21 +239,21 @@ function import_profile_photo($photo,$uid,$cid) { $hash = photo_new_resource(); - $r = $img->store($uid, $cid, $hash, $filename, t('Contact Photos'), 4 ); + $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 4 ); if($r === false) $photo_failure = true; $img->scaleImage(80); - $r = $img->store($uid, $cid, $hash, $filename, t('Contact Photos'), 5 ); + $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 5 ); if($r === false) $photo_failure = true; $img->scaleImage(48); - $r = $img->store($uid, $cid, $hash, $filename, t('Contact Photos'), 6 ); + $r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 6 ); if($r === false) $photo_failure = true; @@ -259,9 +268,9 @@ function import_profile_photo($photo,$uid,$cid) { $photo_failure = true; if($photo_failure) { - $photo = $a->get_baseurl() . '/images/default-profile.jpg'; - $thumb = $a->get_baseurl() . '/images/default-profile-sm.jpg'; - $micro = $a->get_baseurl() . '/images/default-profile-mm.jpg'; + $photo = $a->get_baseurl() . '/images/person-175.jpg'; + $thumb = $a->get_baseurl() . '/images/person-80.jpg'; + $micro = $a->get_baseurl() . '/images/person-48.jpg'; } return(array($photo,$thumb,$micro));