hubzilla issue #868
This commit is contained in:
parent
d88d4b3c3a
commit
7fb02752de
@ -91,6 +91,7 @@ class Thing extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
$orig_record = $t[0];
|
$orig_record = $t[0];
|
||||||
if($photo != $orig_record['obj_imgurl']) {
|
if($photo != $orig_record['obj_imgurl']) {
|
||||||
|
delete_thing_photo($orig_record['obj_imgurl'],get_observer_hash());
|
||||||
$arr = import_xchan_photo($photo,get_observer_hash(),true);
|
$arr = import_xchan_photo($photo,get_observer_hash(),true);
|
||||||
$local_photo = $arr[0];
|
$local_photo = $arr[0];
|
||||||
$local_photo_type = $arr[3];
|
$local_photo_type = $arr[3];
|
||||||
@ -336,6 +337,9 @@ class Thing extends \Zotlabs\Web\Controller {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
delete_thing_photo($r[0]['obj_imgurl'],get_observer_hash());
|
||||||
|
|
||||||
$x = q("delete from obj where obj_obj = '%s' and obj_type = %d and obj_channel = %d",
|
$x = q("delete from obj where obj_obj = '%s' and obj_type = %d and obj_channel = %d",
|
||||||
dbesc($thing_hash),
|
dbesc($thing_hash),
|
||||||
intval(TERM_OBJ_THING),
|
intval(TERM_OBJ_THING),
|
||||||
|
@ -518,6 +518,27 @@ function guess_image_type($filename, $headers = '') {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function delete_thing_photo($url,$ob_hash) {
|
||||||
|
|
||||||
|
$hash = basename($url);
|
||||||
|
$hash = substr($hash,0,strpos($hash,'-'));
|
||||||
|
|
||||||
|
// hashes should be 32 bytes.
|
||||||
|
|
||||||
|
if(strlen($hash) < 16)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$r = q("delete from photo where xchan = '%s' and photo_usage = %d and resource_id = '%s'",
|
||||||
|
dbesc($ob_hash),
|
||||||
|
intval(PHOTO_THING),
|
||||||
|
dbesc($hash)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function import_xchan_photo($photo,$xchan,$thing = false) {
|
function import_xchan_photo($photo,$xchan,$thing = false) {
|
||||||
|
|
||||||
$flags = (($thing) ? PHOTO_THING : PHOTO_XCHAN);
|
$flags = (($thing) ? PHOTO_THING : PHOTO_XCHAN);
|
||||||
|
Reference in New Issue
Block a user