aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-04-25 20:01:24 -0700
committerfriendica <info@friendica.com>2013-04-25 20:01:24 -0700
commit72e83f69bc3afe3646b423a19f11c99d03e3b66a (patch)
tree130a7a1d0a45f3116c5729e6d7913ffcabff0acf /mod
parentd3b5e678908864d889b916ad2f976c1af16ca360 (diff)
downloadvolse-hubzilla-72e83f69bc3afe3646b423a19f11c99d03e3b66a.tar.gz
volse-hubzilla-72e83f69bc3afe3646b423a19f11c99d03e3b66a.tar.bz2
volse-hubzilla-72e83f69bc3afe3646b423a19f11c99d03e3b66a.zip
photo driver abstraction
Diffstat (limited to 'mod')
-rw-r--r--mod/crepair.php2
-rw-r--r--mod/fbrowser.php2
-rw-r--r--mod/import.php4
-rw-r--r--mod/photo.php4
-rw-r--r--mod/photos.php13
-rw-r--r--mod/profile_photo.php8
-rw-r--r--mod/wall_upload.php2
7 files changed, 19 insertions, 16 deletions
diff --git a/mod/crepair.php b/mod/crepair.php
index e5ece0f98..f749fac0e 100644
--- a/mod/crepair.php
+++ b/mod/crepair.php
@@ -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']);
diff --git a/mod/fbrowser.php b/mod/fbrowser.php
index d10d8021b..31004c0d8 100644
--- a/mod/fbrowser.php
+++ b/mod/fbrowser.php
@@ -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
diff --git a/mod/import.php b/mod/import.php
index 8b8019a99..4602c8aa8 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -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",
diff --git a/mod/photo.php b/mod/photo.php
index aff4dc895..43418e524 100644
--- a/mod/photo.php
+++ b/mod/photo.php
@@ -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();
diff --git a/mod/photos.php b/mod/photos.php
index 0564cb3ff..84a12aacb 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -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');
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index ea7a01bc9..64dfc0e83 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -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);
}
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index cee40744f..0d24755d2 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -1,6 +1,6 @@
<?php
-require_once('Photo.php');
+require_once('include/photo/photo_driver.php');
require_once('include/photos.php');