aboutsummaryrefslogtreecommitdiffstats
path: root/mod/photo.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-07-01 16:48:07 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-07-01 16:48:07 -0700
commit6348e70daa113e8b3203de8fbc919d08c90d972e (patch)
tree1bc3dd3bc85fe6136411086785cf6753960e22f9 /mod/photo.php
downloadvolse-hubzilla-6348e70daa113e8b3203de8fbc919d08c90d972e.tar.gz
volse-hubzilla-6348e70daa113e8b3203de8fbc919d08c90d972e.tar.bz2
volse-hubzilla-6348e70daa113e8b3203de8fbc919d08c90d972e.zip
Initial checkin
Diffstat (limited to 'mod/photo.php')
-rw-r--r--mod/photo.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/mod/photo.php b/mod/photo.php
new file mode 100644
index 000000000..bd0e415bf
--- /dev/null
+++ b/mod/photo.php
@@ -0,0 +1,25 @@
+<?php
+
+function photo_init(&$a) {
+
+ if($a->argc != 2) {
+ killme();
+ }
+ $resolution = 0;
+ $photo = $a->argv[1];
+ $photo = str_replace('.jpg','',$photo);
+ if(substr($photo,-2,1) == '-') {
+ $resolution = intval(substr($photo,-1,1));
+ $photo = substr($photo,0,-2);
+ }
+ $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s'
+ AND `scale` = %d LIMIT 1",
+ dbesc($photo),
+ intval($resolution));
+ if($r === NULL || (! count($r))) {
+ killme();
+ }
+ header("Content-type: image/jpeg");
+ echo $r[0]['data'];
+
+} \ No newline at end of file