photo driver abstraction

This commit is contained in:
friendica
2013-04-25 20:01:24 -07:00
parent d3b5e67890
commit 72e83f69bc
15 changed files with 461 additions and 496 deletions

View File

@@ -76,7 +76,7 @@ function crepair_post(&$a) {
if($photo) {
logger('mod-crepair: updating photo from ' . $photo);
require_once("Photo.php");
require_once('include/photo/photo_driver.php');
$photos = import_profile_photo($photo,local_user(),$contact['id']);

View File

@@ -5,7 +5,7 @@
* @author Fabio Comuni <fabrixxm@kirgroup.com>
*/
require_once('include/Photo.php');
require_once('include/photo/photo_driver.php');
/**
* @param App $a

View File

@@ -114,7 +114,7 @@ function import_post(&$a) {
$channel = $r[0];
if($data['photo']) {
require_once('include/Photo.php');
require_once('include/photo/photo_driver.php');
import_channel_photo(base64url_decode($data['photo']['data']),$data['photo']['type'],get_account_id,$channel['channel_id']);
}
@@ -217,7 +217,7 @@ function import_post(&$a) {
. "')" );
require_once("Photo.php");
require_once('include/photo/photo_driver.php');
$photos = import_profile_photo($xchan['xchan_photo_l'],$xchan['xchan_hash']);
$r = q("update xchan set xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s'
where xchan_hash = '%s' limit 1",

View File

@@ -1,7 +1,7 @@
<?php
require_once('include/security.php');
require_once('include/Photo.php');
require_once('include/photo/photo_driver.php');
function photo_init(&$a) {
@@ -151,7 +151,7 @@ function photo_init(&$a) {
}
if(isset($res) && intval($res) && $res < 500) {
$ph = new Photo($data, $mimetype);
$ph = photo_factory($data, $mimetype);
if($ph->is_valid()) {
$ph->scaleImageSquare($res);
$data = $ph->imageString();

View File

@@ -1,5 +1,5 @@
<?php
require_once('include/Photo.php');
require_once('include/photo/photo_driver.php');
require_once('include/photos.php');
require_once('include/items.php');
require_once('include/acl_selectors.php');
@@ -59,7 +59,9 @@ function photos_post(&$a) {
logger('mod_photos: REQUEST ' . print_r($_REQUEST,true), LOGGER_DATA);
logger('mod_photos: FILES ' . print_r($_FILES,true), LOGGER_DATA);
$phototypes = Photo::supportedTypes();
$ph = photo_factory('');
$phototypes = $ph->supportedTypes();
$can_post = false;
@@ -233,7 +235,7 @@ function photos_post(&$a) {
intval($page_owner_uid)
);
if(count($r)) {
$ph = new Photo($r[0]['data'], $r[0]['type']);
$ph = photo_factory($r[0]['data'], $r[0]['type']);
if($ph->is_valid()) {
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
$ph->rotate($rotate_deg);
@@ -565,7 +567,8 @@ function photos_content(&$a) {
return;
}
$phototypes = Photo::supportedTypes();
$ph = photo_factory('');
$phototypes = $ph->supportedTypes();
$_SESSION['photo_return'] = $a->cmd;
@@ -1152,7 +1155,7 @@ function photos_content(&$a) {
$dislike = '';
// display comments
if(count($r)) {
if($r) {
foreach($r as $item) {
like_puller($a,$item,$alike,'like');

View File

@@ -1,6 +1,6 @@
<?php
require_once("Photo.php");
require_once('include/photo/photo_driver.php');
function profile_photo_init(&$a) {
@@ -77,7 +77,7 @@ function profile_photo_post(&$a) {
$base_image = $r[0];
$im = new Photo($base_image['data'], $base_image['type']);
$im = photo_factory($base_image['data'], $base_image['type']);
if($im->is_valid()) {
$im->cropImage(175,$srcX,$srcY,$srcW,$srcH);
@@ -164,7 +164,7 @@ function profile_photo_post(&$a) {
}
$imagedata = @file_get_contents($src);
$ph = new Photo($imagedata, $filetype);
$ph = photo_factory($imagedata, $filetype);
if(! $ph->is_valid()) {
notice( t('Unable to process image.') . EOL );
@@ -251,7 +251,7 @@ function profile_photo_content(&$a) {
return;
}
$ph = new Photo($r[0]['data'], $r[0]['type']);
$ph = photo_factory($r[0]['data'], $r[0]['type']);
// go ahead as if we have just uploaded a new photo to crop
profile_photo_crop_ui_head($a, $ph);
}

View File

@@ -1,6 +1,6 @@
<?php
require_once('Photo.php');
require_once('include/photo/photo_driver.php');
require_once('include/photos.php');