mirror of
https://github.com/rkd77/elinks.git
synced 2025-06-30 22:19:29 -04:00
[images] Handle png and jpegs internally when kitty or sixel are enabled.
This commit is contained in:
parent
f324ba28a2
commit
7a4cdc3a43
@ -125,6 +125,25 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
|
|||||||
render_plain_document(cached, document, &buffer);
|
render_plain_document(cached, document, &buffer);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
#if defined(CONFIG_KITTY) || defined(CONFIG_LIBSIXEL)
|
||||||
|
if (!c_strcasecmp("image/png", cached->content_type)
|
||||||
|
|| !c_strcasecmp("image/jpg", cached->content_type)
|
||||||
|
|| !c_strcasecmp("image/jpeg", cached->content_type)) {
|
||||||
|
struct string img;
|
||||||
|
|
||||||
|
if (init_string(&img)) {
|
||||||
|
add_format_to_string(&img, "<img src=\"%s\">", struri(cached->uri));
|
||||||
|
|
||||||
|
if (encoding != ENCODING_NONE) {
|
||||||
|
done_string(&buffer);
|
||||||
|
}
|
||||||
|
encoding = ENCODINGS_KNOWN;
|
||||||
|
buffer.source = img.source;
|
||||||
|
buffer.length = img.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DOM
|
#ifdef CONFIG_DOM
|
||||||
if (cached->content_type
|
if (cached->content_type
|
||||||
&& (!c_strlcasecmp("application/rss+xml", 19, cached->content_type, -1)))
|
&& (!c_strlcasecmp("application/rss+xml", 19, cached->content_type, -1)))
|
||||||
@ -137,7 +156,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
|
|||||||
else
|
else
|
||||||
#ifdef CONFIG_LIBDOM
|
#ifdef CONFIG_LIBDOM
|
||||||
if (1) {
|
if (1) {
|
||||||
if (encoding != ENCODING_NONE) {
|
if (encoding != ENCODING_NONE && encoding != ENCODINGS_KNOWN) {
|
||||||
done_string(&buffer);
|
done_string(&buffer);
|
||||||
encoding = ENCODING_NONE;
|
encoding = ENCODING_NONE;
|
||||||
}
|
}
|
||||||
|
@ -1958,6 +1958,11 @@ struct {
|
|||||||
{ "application/xbel+xml", 1 },
|
{ "application/xbel+xml", 1 },
|
||||||
{ "application/xbel", 1 },
|
{ "application/xbel", 1 },
|
||||||
{ "application/x-xbel", 1 },
|
{ "application/x-xbel", 1 },
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_KITTY) || defined(CONFIG_LIBSIXEL)
|
||||||
|
{ "image/png", 0 },
|
||||||
|
{ "image/jpg", 0 },
|
||||||
|
{ "image/jpeg", 0 },
|
||||||
#endif
|
#endif
|
||||||
{ NULL, 1 },
|
{ NULL, 1 },
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user