Skip to content

Commit bab559b

Browse files
authored
Favicon (#30)
* New icons, correctly tinted and compressed * Handle the new icon URI's in the main app. * Remove the PROGMEM directives, they have no effect, and we have lots of storage. * describe how I made the .ico file from the commandline
1 parent 8ef24aa commit bab559b

File tree

13 files changed

+734
-138
lines changed

13 files changed

+734
-138
lines changed

Docs/headline-image.png

97.7 KB
Loading

Docs/logo-big.png

36.8 KB
Loading

Docs/logo.png

5.95 KB
Loading

Docs/logo.svg

Lines changed: 117 additions & 136 deletions
Loading

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,25 @@ Please do not submit PR's onto the master branch of my repo unless they are very
9999

100100
## Plans
101101

102+
Time allowing; my Current plan is:
103+
104+
V3 Options, UI and server enhancements;
105+
* All the primary config options moved to the `myconfig.h` file.
106+
* Miniviewer, favicons
107+
* UI now shows stream links and build info
108+
* Nearly Complete
109+
110+
V4 Preferences;
111+
* Cam module preferences and face recognition Db saved between sessions in LittleFS (formerly SPIFS).
112+
* Upload/Download FaceDB as Json document in browser
113+
* Investigate using SD card to capture images
114+
* Not started; will have to wait until I have time.
115+
116+
V5 Remove face recognition entirely;
117+
* Dont try to make it optional, this is a code and maintenance nightmare. V4 can be maintained on a branch for those who need it.
118+
* implement OTA and a better network stack for remembering multiple AP's, auto-config etc.
119+
* UI Skinning/Theming
120+
102121
You can check the [enhancement list](https://github.com/easytarget/esp32-cam-webserver/issues?q=is%3Aissue+label%3Aenhancement) (past and present), and add any thoghts you may have there. Things that have occurred to me are, in no particular order:
103122
* Improve Wifi, add a captive portal for setup and fallback, better disconnect/reconnect behaviour.
104123
* The module has a SD/TF card slot; this is currently unused, but I would like to add the ability to store snapshots; recording Video at low resolution may be possible, but the card interface is too slow for HD video as far as I know.

app_httpd.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "camera_index_ov2640.h"
2121
#include "camera_index_ov3660.h"
22+
#include "favicon/favicons.h"
2223

2324
//#define DEBUG_STREAM_DATA // Debug: dump info for each stream frame on serial port
2425

@@ -632,6 +633,33 @@ static esp_err_t status_handler(httpd_req_t *req){
632633
return httpd_resp_send(req, json_response, strlen(json_response));
633634
}
634635

636+
static esp_err_t favicon_16x16_handler(httpd_req_t *req){
637+
flashLED(75); // a little feedback to user
638+
delay(75);
639+
flashLED(75);
640+
httpd_resp_set_type(req, "image/png");
641+
httpd_resp_set_hdr(req, "Content-Encoding", "identity");
642+
return httpd_resp_send(req, (const char *)favicon_16x16_png, favicon_16x16_png_len);
643+
}
644+
645+
static esp_err_t favicon_32x32_handler(httpd_req_t *req){
646+
flashLED(75); // a little feedback to user
647+
delay(75);
648+
flashLED(75);
649+
httpd_resp_set_type(req, "image/png");
650+
httpd_resp_set_hdr(req, "Content-Encoding", "identity");
651+
return httpd_resp_send(req, (const char *)favicon_32x32_png, favicon_32x32_png_len);
652+
}
653+
654+
static esp_err_t favicon_ico_handler(httpd_req_t *req){
655+
flashLED(75); // a little feedback to user
656+
delay(75);
657+
flashLED(75);
658+
httpd_resp_set_type(req, "image/x-icon");
659+
httpd_resp_set_hdr(req, "Content-Encoding", "identity");
660+
return httpd_resp_send(req, (const char *)favicon_ico, favicon_ico_len);
661+
}
662+
635663
static esp_err_t index_handler(httpd_req_t *req){
636664
flashLED(75); // a little feedback to user
637665
delay(75);
@@ -676,6 +704,27 @@ void startCameraServer(int hPort, int sPort){
676704
.user_ctx = NULL
677705
};
678706

707+
httpd_uri_t favicon_16x16_uri = {
708+
.uri = "/favicon-16x16.png",
709+
.method = HTTP_GET,
710+
.handler = favicon_16x16_handler,
711+
.user_ctx = NULL
712+
};
713+
714+
httpd_uri_t favicon_32x32_uri = {
715+
.uri = "/favicon-32x32.png",
716+
.method = HTTP_GET,
717+
.handler = favicon_32x32_handler,
718+
.user_ctx = NULL
719+
};
720+
721+
httpd_uri_t favicon_ico_uri = {
722+
.uri = "/favicon.ico",
723+
.method = HTTP_GET,
724+
.handler = favicon_ico_handler,
725+
.user_ctx = NULL
726+
};
727+
679728
httpd_uri_t stream_uri = {
680729
.uri = "/",
681730
.method = HTTP_GET,
@@ -710,6 +759,9 @@ void startCameraServer(int hPort, int sPort){
710759
httpd_register_uri_handler(camera_httpd, &cmd_uri);
711760
httpd_register_uri_handler(camera_httpd, &status_uri);
712761
httpd_register_uri_handler(camera_httpd, &capture_uri);
762+
httpd_register_uri_handler(camera_httpd, &favicon_16x16_uri);
763+
httpd_register_uri_handler(camera_httpd, &favicon_32x32_uri);
764+
httpd_register_uri_handler(camera_httpd, &favicon_ico_uri);
713765
}
714766

715767

@@ -718,5 +770,8 @@ void startCameraServer(int hPort, int sPort){
718770
Serial.printf("Starting stream server on port: '%d'\n", config.server_port);
719771
if (httpd_start(&stream_httpd, &config) == ESP_OK) {
720772
httpd_register_uri_handler(stream_httpd, &stream_uri);
773+
httpd_register_uri_handler(stream_httpd, &favicon_16x16_uri);
774+
httpd_register_uri_handler(stream_httpd, &favicon_32x32_uri);
775+
httpd_register_uri_handler(stream_httpd, &favicon_ico_uri);
721776
}
722777
}

0 commit comments

Comments
 (0)