Skip to content

Commit

Permalink
some bug fix on image retrieval
Browse files Browse the repository at this point in the history
(twittering-image-type): bug fix in the case of bitmap
(twittering-retrieve-image): handle error of determining image
type.
(twittering-image-type): let case-fold-search is t.
  • Loading branch information
hayamiz committed Jan 10, 2010
1 parent b28e832 commit 72d6d83
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Expand Up @@ -74,6 +74,10 @@
(twittering-retrieve-image-with-wget): delete
(twittering-retrieve-image): changed default image type from png
to xpm
(twittering-image-type): bug fix in the case of bitmap
(twittering-retrieve-image): handle error of determining image
type.
(twittering-image-type): let case-fold-search is t.

* url-emacs21/*: add url library for emacs21

Expand Down
16 changes: 9 additions & 7 deletions twittering-mode.el
Expand Up @@ -317,7 +317,8 @@ invoking \"convert\". Otherwise, cropped images are displayed.")
(defun twittering-image-type (image-url buffer)
"Return the type of a given image based on the URL(IMAGE-URL)
and its contents(BUFFER)"
(let ((type-cache (assoc image-url twittering-image-type-cache)))
(let ((type-cache (assoc image-url twittering-image-type-cache))
(case-fold-search t))
(if type-cache
(cdr type-cache)
(let ((image-type
Expand All @@ -332,11 +333,11 @@ and its contents(BUFFER)"
nil res-buf nil "-b" "-")))
(let ((file-output (buffer-string)))
(cond
((string-match "JPEG" file-output) 'jpeg)
((string-match "PNG" file-output) 'png)
((string-match "GIF" file-output) 'gif)
((string-match "bitmap" 'bitmap))
(t nil)))))
((string-match "JPEG" file-output) 'jpeg)
((string-match "PNG" file-output) 'png)
((string-match "GIF" file-output) 'gif)
((string-match "bitmap" file-output) 'bitmap)
(t nil)))))
((string-match "\\.jpe?g\\(\\?[^/]+\\)?$" image-url) 'jpeg)
((string-match "\\.png\\(\\?[^/]+\\)?$" image-url) 'png)
((string-match "\\.gif\\(\\?[^/]+\\)?$" image-url) 'gif)
Expand Down Expand Up @@ -1977,7 +1978,8 @@ following symbols;
(point-min) (point-max)
twittering-convert-program
t t nil
(format "%s:-" image-type) "-resize"
(if image-type (format "%s:-" image-type) "-")
"-resize"
(format "%dx%d" twittering-convert-fix-size
twittering-convert-fix-size)
"xpm:-")
Expand Down

0 comments on commit 72d6d83

Please sign in to comment.