public
Description: The ultra-lightweight ultra-flexible blogging engine with a fetish for birds and misspellings.
Homepage: http://chyrp.net/
Clone URL: git://github.com/vito/chyrp.git
Click here to lend your support to: chyrp and make a donation at www.pledgie.com !
Split the Photo feather's image_tag_for function into image_link and
image_tag.
vito (author)
Sat Nov 01 22:39:02 -0700 2008
commit  c3d2b2820162af5a9c669aa12b460c7913d82791
tree    6d6a8f112c3724ecc9ffe8d0f4b00efeeb2b845b
parent  08bfcbbd0492940b546a39dbb67bd8ecd3185c70
...
104
105
106
107
 
108
109
110
...
114
115
116
117
 
118
119
120
 
121
122
123
124
125
 
 
 
 
 
 
126
127
128
...
147
148
149
 
...
104
105
106
 
107
108
109
110
...
114
115
116
 
117
118
119
 
120
121
122
 
123
 
124
125
126
127
128
129
130
131
132
...
151
152
153
154
0
@@ -104,7 +104,7 @@
0
         }
0
 
0
         public function feed_content($post) {
0
-            return self::image_tag_for($post, 500, 500)."<br /><br />".$post->caption;
0
+            return self::image_tag($post, 500, 500)."<br /><br />".$post->caption;
0
         }
0
 
0
         public function delete_file($post) {
0
@@ -114,15 +114,19 @@
0
 
0
         public function filter_post($post) {
0
             if ($post->feather != "photo") return;
0
-            $post->image = $this->image_tag_for($post);
0
+            $post->image = $this->image_tag($post);
0
         }
0
 
0
-        public function image_tag_for($post, $max_width = 500, $max_height = null, $more_args = "quality=100") {
0
+        public function image_tag($post, $max_width = 500, $max_height = null, $more_args = "quality=100") {
0
             $filename = $post->filename;
0
             $config = Config::current();
0
-            $source = !empty($post->source) ? $post->source : uploaded($filename) ;
0
             $alt = !empty($post->alt_text) ? fix($post->alt_text, true) : $filename ;
0
-            return '<a href="'.$source.'"><img src="'.$config->chyrp_url.'/includes/thumb.php?file=..'.$config->uploads_path.urlencode($filename).'&amp;max_width='.$max_width.'&amp;max_height='.$max_height.'&amp;'.$more_args.'" alt="'.$alt.'" /></a>';
0
+            return '<img src="'.$config->chyrp_url.'/includes/thumb.php?file=..'.$config->uploads_path.urlencode($filename).'&amp;max_width='.$max_width.'&amp;max_height='.$max_height.'&amp;'.$more_args.'" alt="'.$alt.'" />';
0
+        }
0
+
0
+        public function image_link($post, $max_width = 500, $max_height = null, $more_args="quality=100") {
0
+            $source = !empty($post->source) ? $post->source : uploaded($post->filename) ;
0
+            return '<a href="'.$source.'">'.$this->image_tag($post, $max_width, $max_height, $more_args).'</a>';
0
         }
0
 
0
         public function add_option($options, $post = null) {
0
@@ -147,3 +151,4 @@
0
             return $options;
0
         }
0
     }
0
+
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 {% extends "content/post.twig" %}
0
 
0
 {% block content %}
0
-                        ${ feathers['photo'].image_tag_for(post, 434) }
0
+                        ${ feathers['photo'].image_link(post, 434) }
0
                         <div class="clear"></div>
0
                         ${ post.caption | read_more }
0
 {% endblock %}

Comments