From 52f06cabd2d505d8973506ee563b76409ff3412a Mon Sep 17 00:00:00 2001 From: Haakon Meland Eriksen Date: Wed, 28 Oct 2015 07:34:11 +0100 Subject: [PATCH 1/3] Updated Hubzilla on OpenShift help page to clarify hosting for three gears is available at no cost as of this writing, 2015-10-28 --- doc/Hubzilla_on_OpenShift.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/Hubzilla_on_OpenShift.bb b/doc/Hubzilla_on_OpenShift.bb index db61c3a48..9b2c539dc 100644 --- a/doc/Hubzilla_on_OpenShift.bb +++ b/doc/Hubzilla_on_OpenShift.bb @@ -1,7 +1,9 @@ [b]Hubzilla on OpenShift[/b] You will notice a new .openshift folder when you fetch from upstream, i.e. from [url=https://github.com/redmatrix/hubzilla.git]https://github.com/redmatrix/hubzilla.git[/url] , which contains a deploy script to set up Hubzilla on OpenShift with plugins and extra themes. -Create an account on OpenShift, then use the registration e-mail and password to create your first Hubzilla instance. Install git and RedHat's command line tools - rhc - if you have not already done so. +As of this writing, 2015-10-28, you do not have to pay for OpenShift on the Free plan, which gives you three gears at no cost. The Bronze plan gives you three gears at no cost too, but you can expand to 16 gears by paying, and this requires you to register your payment card. The three gears can give three instances of Hubzilla with one gear each, or you can combine two gears into one high-availability Hubzilla instance and one extra gear. The main difference to be aware of is this: gears on the Free plan will go into hibernation if left idle for too long, this does not happen on the Bronze plan. + +Create an account on OpenShift, then use the registration e-mail and password to create your first Hubzilla instance. Install git and RedHat's command line tools - rhc - if you have not already done so. See for example https://developers.openshift.com/en/getting-started-debian-ubuntu.html on how to do this on Debian GNU/Linux, or in the menu on that page for other GNU/Linux distributions or other operating systems. [code]rhc app-create your_app_name php-5.4 mysql-5.5 cron phpmyadmin --namespace your_domain --from-code https://github.com/redmatrix/hubzilla.git -l your@email.address -p your_account_password [/code] From 1375ed6aea765f16ff70606187d1458ee85ea6d9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 28 Oct 2015 20:01:50 +0100 Subject: [PATCH 2/3] pathinfo() does not work in this case. getimagesize() seems more reliabel. this fixes transparent png avatars having a black background. --- include/photo/photo_driver.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 32b9bd302..d439e9877 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -542,6 +542,7 @@ function guess_image_type($filename, $headers = '') { } } +/* if(is_null($type)) { $ext = pathinfo($filename, PATHINFO_EXTENSION); $ph = photo_factory(''); @@ -551,6 +552,13 @@ function guess_image_type($filename, $headers = '') { if ($ext==$e) $type = $m; } } +*/ + if(is_null($type)) { + $size = getimagesize($filename); + $ph = photo_factory(''); + $types = $ph->supportedTypes(); + $type = ((array_key_exists($size['mime'], $types)) ? $size['mime'] : 'image/jpeg'); + } } logger('Photo: guess_image_type: type='.$type, LOGGER_DEBUG); return $type; From a5f1fa3168d487655d4743f7680d36d80053b34f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 28 Oct 2015 21:52:15 +0100 Subject: [PATCH 3/3] re-enable pathinfo() check and try with getimagesize() if we have not got a result --- include/photo/photo_driver.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index d439e9877..810e0cdc7 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -542,23 +542,22 @@ function guess_image_type($filename, $headers = '') { } } -/* if(is_null($type)) { $ext = pathinfo($filename, PATHINFO_EXTENSION); $ph = photo_factory(''); $types = $ph->supportedTypes(); - $type = "image/jpeg"; foreach ($types as $m=>$e){ if ($ext==$e) $type = $m; } } -*/ + if(is_null($type)) { $size = getimagesize($filename); $ph = photo_factory(''); $types = $ph->supportedTypes(); $type = ((array_key_exists($size['mime'], $types)) ? $size['mime'] : 'image/jpeg'); } + } logger('Photo: guess_image_type: type='.$type, LOGGER_DEBUG); return $type;