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 !
* Photo feather now allows you to provide alt-text. [#130 state:resolved]
* image_tag_for takes Post as the first argument now, as opposed to just 
Post->filename.
vito (author)
Tue Jun 24 14:30:58 -0700 2008
commit  47310104b139f20fe61b222eeabf892d67d5b91a
tree    18c462555375afede125893d639c16f4f7f9f7a1
parent  d2383cd815985e6883fe7759f418c0573af460a1
...
7
8
9
 
 
10
11
12
...
62
63
64
65
 
66
67
68
...
70
71
72
73
 
74
75
 
 
76
77
78
 
 
 
 
 
 
 
 
 
 
 
79
80
...
7
8
9
10
11
12
13
14
...
64
65
66
 
67
68
69
70
...
72
73
74
 
75
76
 
77
78
79
80
 
81
82
83
84
85
86
87
88
89
90
91
92
93
0
@@ -7,6 +7,8 @@
0
       $this->setFilter("caption", "markup_post_text");
0
       $this->respondTo("delete_post", "delete_file");
0
       $this->respondTo("filter_post", "filter_post");
0
+      $this->respondTo("new_post_options", "alt_text_field");
0
+      $this->respondTo("edit_post_options", "alt_text_field");
0
 
0
       if (!file_exists(INCLUDES_DIR."/caches/phpthumb/"))
0
         mkdir(INCLUDES_DIR."/caches/phpthumb/");
0
@@ -62,7 +64,7 @@
0
       return $post->caption;
0
     }
0
     public function feed_content($post) {
0
-      return self::image_tag_for($post->filename, 500, 500)."<br /><br />".$post->caption;
0
+      return self::image_tag_for($post, 500, 500)."<br /><br />".$post->caption;
0
     }
0
     public function delete_file($post) {
0
       if ($post->feather != "photo") return;
0
@@ -70,11 +72,22 @@
0
     }
0
     public function filter_post($post) {
0
       if ($post->feather != "photo") return;
0
-      $post->image = $this->image_tag_for($post->filename);
0
+      $post->image = $this->image_tag_for($post);
0
     }
0
-    public function image_tag_for($filename, $max_width = 500, $max_height = null, $more_args = "q=100") {
0
+    public function image_tag_for($post, $max_width = 500, $max_height = null, $more_args = "q=100") {
0
+      $filename = $post->filename;
0
       $ext = pathinfo($filename, PATHINFO_EXTENSION);
0
       $config = Config::current();
0
-      return '<a href="'.$config->chyrp_url.$config->uploads_path.$filename.'"><img src="'.$config->chyrp_url.'/feathers/photo/lib/phpThumb.php?src='.$config->chyrp_url.$config->uploads_path.urlencode($filename).'&amp;w='.$max_width.'&amp;h='.$max_height.'&amp;f='.$ext.'&amp;'.$more_args.'" alt="'.$filename.'" /></a>';
0
+      return '<a href="'.$config->chyrp_url.$config->uploads_path.$filename.'"><img src="'.$config->chyrp_url.'/fsdffeathers/photo/lib/phpThumb.php?src='.$config->chyrp_url.$config->uploads_path.urlencode($filename).'&amp;w='.$max_width.'&amp;h='.$max_height.'&amp;f='.$ext.'&amp;'.$more_args.'" alt="'.fallback($post->alt_text, $filename, true).'" /></a>';
0
+    }
0
+    public function alt_text_field($post = null) {
0
+      if (isset($post) and $post->feather != "photo") return;
0
+      if (isset($_GET['feather']) and $_GET['feather'] != "photo") return;
0
+?>
0
+          <p>
0
+            <label for="option_alt_text"><?php echo __("Alt-Text", "photo"); ?></label>
0
+            <input class="text" type="text" name="option[alt_text]" value="<?php echo fix(fallback($post->alt_text, "", true)); ?>" id="alt_text" />
0
+          </p>
0
+<?php
0
     }
0
   }
...
1
 
2
3
...
 
1
2
3
0
@@ -1,2 +1,2 @@
0
-            ${ feathers.photo.image_tag_for(post.filename, 448) }
0
+            ${ feathers.photo.image_tag_for(post, 448) }
0
             ${ post.caption | read_more }
0
\ No newline at end of file

Comments