aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2012-06-07 20:17:31 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2012-06-07 20:17:31 +0200
commit2438c6e45d47ca194b51f99ddf113112fbb6ccb9 (patch)
tree27c32cdfbaa3a63877b118609b5177c705ff747a /include
parent7cc8c369cb6a01cffb58215966844b53794f32f4 (diff)
downloadvolse-hubzilla-2438c6e45d47ca194b51f99ddf113112fbb6ccb9.tar.gz
volse-hubzilla-2438c6e45d47ca194b51f99ddf113112fbb6ccb9.tar.bz2
volse-hubzilla-2438c6e45d47ca194b51f99ddf113112fbb6ccb9.zip
png support: update database.sql, fix some typos, fix tinymce image browser
Diffstat (limited to 'include')
-rw-r--r--include/Photo.php24
1 files changed, 13 insertions, 11 deletions
diff --git a/include/Photo.php b/include/Photo.php
index ffefc37ec..f769a70a6 100644
--- a/include/Photo.php
+++ b/include/Photo.php
@@ -105,9 +105,9 @@ class Photo {
$dest = imagecreatetruecolor( $dest_width, $dest_height );
- imagealphablending($dest->image, false);
+ imagealphablending($dest, false);
imagesavealpha($dest, true);
- if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127));; // fill with alpha
+ if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dest_width, $dest_height, $width, $height);
if($this->image)
imagedestroy($this->image);
@@ -164,9 +164,9 @@ class Photo {
$dest = imagecreatetruecolor( $dest_width, $dest_height );
- imagealphablending($dest->image, false);
+ imagealphablending($dest, false);
imagesavealpha($dest, true);
- if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127));; // fill with alpha
+ if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dest_width, $dest_height, $width, $height);
if($this->image)
imagedestroy($this->image);
@@ -181,9 +181,9 @@ class Photo {
public function scaleImageSquare($dim) {
$dest = imagecreatetruecolor( $dim, $dim );
- imagealphablending($dest->image, false);
+ imagealphablending($dest, false);
imagesavealpha($dest, true);
- if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127));; // fill with alpha
+ if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
imagecopyresampled($dest, $this->image, 0, 0, 0, 0, $dim, $dim, $this->width, $this->height);
if($this->image)
imagedestroy($this->image);
@@ -195,9 +195,9 @@ class Photo {
public function cropImage($max,$x,$y,$w,$h) {
$dest = imagecreatetruecolor( $max, $max );
- imagealphablending($dest->image, false);
+ imagealphablending($dest, false);
imagesavealpha($dest, true);
- if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127));; // fill with alpha
+ if ($this->type=='image/png') imagefill($dest, 0, 0, imagecolorallocatealpha($dest, 0, 0, 0, 127)); // fill with alpha
imagecopyresampled($dest, $this->image, 0, 0, $x, $y, $max, $max, $w, $h);
if($this->image)
imagedestroy($this->image);
@@ -295,6 +295,7 @@ class Photo {
* @arg $fromcurl boolean Check Content-Type header from curl request
*/
function guess_image_type($filename, $fromcurl=false) {
+ logger('Photo: guess_image_type: '.$filename . ($fromcurl?' from curl headers':''), LOGGER_DEBUG);
$type = null;
if ($fromcurl) {
$a = get_app();
@@ -310,12 +311,13 @@ function guess_image_type($filename, $fromcurl=false) {
if (is_null($type)){
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$types = Photo::supportedTypes();
+ $type = "image/jpeg";
foreach ($types as $m=>$e){
- if ($ext==$e) return $m;
+ if ($ext==$e) $type = $m;
}
- $type = "image/jpeg";
- }
+ }
+ logger('Photo: guess_image_type: type='.$type, LOGGER_DEBUG);
return $type;
}