]> git.mxchange.org Git - friendica.git/blobdiff - mod/photo.php
Merge pull request #50 from annando/master
[friendica.git] / mod / photo.php
old mode 100644 (file)
new mode 100755 (executable)
index 9809aa4..c4a9376
@@ -5,6 +5,11 @@ require_once('include/security.php');
 function photo_init(&$a) {
 
        switch($a->argc) {
+               case 4:
+                       $person = $a->argv[3];
+                       $customres = intval($a->argv[2]);
+                       $type = $a->argv[1];
+                       break;
                case 3:
                        $person = $a->argv[2];
                        $type = $a->argv[1];
@@ -29,6 +34,7 @@ function photo_init(&$a) {
                switch($type) {
 
                        case 'profile':
+                       case 'custom':
                                $resolution = 4;
                                break;
                        case 'micro':
@@ -113,8 +119,24 @@ function photo_init(&$a) {
                // NOTREACHED
        }
 
+       if(isset($customres) && $customres > 0 && $customres < 500) {
+               require_once('include/Photo.php');
+               $ph = new Photo($data);
+               if($ph->is_valid()) {
+                       $ph->scaleImageSquare($customres);
+                       $data = $ph->imageString();
+               }
+       }
+
+       if(function_exists('header_remove')) {
+               header_remove('Pragma');
+               header_remove('pragma');
+       }
+
        header("Content-type: image/jpeg");
+       header("Expires: " . gmdate("D, d M Y H:i:s", time() + (3600*24)) . " GMT");
+       header("Cache-Control: max-age=" . (3600*24));
        echo $data;
        killme();
        // NOTREACHED
-}
\ No newline at end of file
+}