photo driver issue when updating contact photos - old class structure used instead of photo_factory()

This commit is contained in:
friendica 2013-05-05 22:49:46 -07:00
parent 175f30d7cc
commit 524f205caa
3 changed files with 7 additions and 5 deletions

View File

@ -1099,7 +1099,7 @@ function check_config(&$a) {
. 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n"
. 'Content-transfer-encoding: 8bit' ); . 'Content-transfer-encoding: 8bit' );
//try the logger //try the logger
logger('CRITICAL: Update Failed: '. $x); logger('CRITICAL: Update Failed: ' . $x);
} }
else else
set_config('database','update_r' . $x, 'success'); set_config('database','update_r' . $x, 'success');

View File

@ -26,7 +26,7 @@ function check_account_email($email) {
$r = q("select account_email from account where account_email = '%s' limit 1", $r = q("select account_email from account where account_email = '%s' limit 1",
dbesc($email) dbesc($email)
); );
if(count($r)) { if($r) {
$result['message'] .= t('Your email address is already registered at this site.'); $result['message'] .= t('Your email address is already registered at this site.');
} }
} }

View File

@ -378,6 +378,7 @@ function guess_image_type($filename, $fromcurl=false) {
$type = $headers['Content-Type']; $type = $headers['Content-Type'];
} }
if (is_null($type)){ if (is_null($type)){
// FIXME!!!!
// Guessing from extension? Isn't that... dangerous? // Guessing from extension? Isn't that... dangerous?
if(class_exists('Imagick') && file_exists($filename) && is_readable($filename)) { if(class_exists('Imagick') && file_exists($filename) && is_readable($filename)) {
/** /**
@ -389,7 +390,8 @@ function guess_image_type($filename, $fromcurl=false) {
$type = $image->getImageMimeType(); $type = $image->getImageMimeType();
} else { } else {
$ext = pathinfo($filename, PATHINFO_EXTENSION); $ext = pathinfo($filename, PATHINFO_EXTENSION);
$types = Photo::supportedTypes(); $ph = photo_factory('');
$types = $ph->supportedTypes();
$type = "image/jpeg"; $type = "image/jpeg";
foreach ($types as $m=>$e){ foreach ($types as $m=>$e){
if ($ext==$e) $type = $m; if ($ext==$e) $type = $m;
@ -427,7 +429,7 @@ function import_profile_photo($photo,$xchan) {
if($result['success']) if($result['success'])
$img_str = $result['body']; $img_str = $result['body'];
$img = new Photo($img_str, $type); $img = photo_factory($img_str, $type);
if($img->is_valid()) { if($img->is_valid()) {
$img->scaleImageSquare(175); $img->scaleImageSquare(175);
@ -485,7 +487,7 @@ function import_channel_photo($photo,$type,$aid,$uid) {
$filename = $hash; $filename = $hash;
$img = new Photo($photo, $type); $img = photo_factory($photo, $type);
if($img->is_valid()) { if($img->is_valid()) {
$img->scaleImageSquare(175); $img->scaleImageSquare(175);