eloquentarduino / EloquentSurveillance

GNU General Public License v3.0
40 stars 10 forks source link

FileServer.h --> not showing right path to images #1

Open dirkclemens opened 2 years ago

dirkclemens commented 2 years ago

Great library! Thanks !

I found one error in file: FileServer.h line 60: html += F("</td><td><a href=\"/view"); should end with an / after view/ line 60: html += F("</td><td><a href=\"/view/");

and line 63: html += filename.substring(0); instead of filename.substring(1)

Patriboom commented 1 year ago

I don't use the same version as you. Do I ? Around those lines, my FileServer.h file looks like:

                            _server.sendContent(F(">"));
                            _server.sendContent(F("<td>"));
                            _server.sendContent(String(i++));
                            _server.sendContent(F("</td><td><a href=\"/view"));
                            _server.sendContent(filename);
                            _server.sendContent(F("\" style=\"font-weight: bold;\" target=\"_blank\">"));
                            _server.sendContent(filename.substring(1));
                            _server.sendContent(F("</a></td><td>"));
                            _server.sendContent(formatBytes(file.size()));
                            _server.sendContent(F("</td><td>"));
                            _server.sendContent(F("<a href=\"/delete"));
                            _server.sendContent(filename);
                            _server.sendContent(F("\" style=\"color: #600; font-weight: bold;\" >X</a>"));
                            _server.sendContent(F("</td></tr>"));

I can find no « html += " expression. About the misstyping you quote on line 60, your correction is useless for my code. The code I downloaded is like the one you pretend wrong but works good for me.

ghmpi commented 1 year ago

Something that may be related.. I tried 1.0.13 and things were not happy with the new rotate code.. on Chrome browser the image would not display.

1.0.12 works fine. I did notice the change in the code for the "/view" vs "/view/" portion. Something changed and it's not happy, at least for me.

Patriboom commented 1 year ago

Since he started the repository EloquentEsp32cam , I think the author doesn't work anymore on the actual one. You may try my fork. If I can help or find the problem, I'll post on my fork (which is, for now, a copy of the original): https://github.com/Patriboom/EloquentSurveillance

ghmpi commented 1 year ago

Is the original author not working on this anymore?

Patriboom commented 1 year ago

I'm not sure, but when I wrote him a personnal message he invited me to adopt the new library. I wrote him one month ago a message about some modifications I suggested for the FileServer.h file. And until then, my modifications are waiting (see « pull requests » ) .... so is my conclusion (from what He wrote me and from the long delay to accept the pull request).

ghmpi commented 1 year ago

Thank you Patriboom for your comments. I was looking for motion detection code for the ESP32 camera.. and came across this. Now I see the other libraries from the same author.. but it seems to be similar to this one with additions maybe? I have to look into them when I have time.

This library itself is not so big, so I can usually find and fix bugs myself, but it takes time. I would, obviously, rather everything work correctly.

It would be good to know that the original author has moved on to something else and is not maintaining this code, if this is indeed the case.

Thank you all!

Patriboom commented 1 year ago

Hello Ghmpi, I'm surprised to read that the code doesn't work. On my ESP32-cam mvt dectector works good. Do you use Windows / Mac / other or Liinux ? Did you forget to change the camera name and other configurations?

  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
  camera.aithinker();
  camera.sxga();
  camera.highQuality();
  mvt.setMinChanges(0.1);
  mvt.setMinPixelDiff(10);
  mvt.setMinSizeDiff(0.05);
  mvt.debounce(10000L);

camera.aithinker is essential.

With ESP32-cam, you have to include the libraries

#include "soc/soc.h"             // disable brownout problems
#include "soc/rtc_cntl_reg.h"    // disable brownout problems

even if you're using EloquentSurveillance

mine also includes #include "driver/rtc_io.h"

So, shortly, my first lines are:

#include <FS.h>
#include <SD_MMC.h>
#include "soc/soc.h"             // disable brownout problems
#include "soc/rtc_cntl_reg.h"    // disable brownout problems
#include "driver/rtc_io.h"

And the first lines of the setup() are:

void setup() {
  Serial.begin(115200);
  delay(3000);

  rtc_gpio_hold_dis(GPIO_NUM_4);    // Libérer la broche 4 de toute emprise
  ledcSetup(7, 5000, 8);            // Utiliser le canal 7 pour contrôler la DEL (flash) connectée au GPIO 4
  ledcAttachPin(4, 7);

  //Définitions utiles à la caractérisation de la caméra et de sa sensibilité aux changements
  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
  camera.aithinker();
  camera.sxga();
  camera.highQuality();
  mvt.setMinChanges(0.1);
  mvt.setMinPixelDiff(10);
  mvt.setMinSizeDiff(0.05);
  mvt.debounce(10000L);

I have to say that I modified the code, so it's not so sure that the original did work at once. I merged the mvt detector and FTP file server. My code reads also config from microSD and write pictures on the same card.
An other version of my modified code (of mvt dectector) sends email on every detection.

ghmpi commented 1 year ago

I tried your suggestions by including the two brownout include files, and the brownout disable line.. still the same thing. I don't believe the device is browning out.

I tried windows 7, and windows 10, Chrome brower on each, plus an android device. Also tried an old version of Internet Explorer and a new version of edge. The newest 1.0.13 rotate code just does not seem to work.

Also, in the main http page where the device lists the jpegs, I get "apture.jpg" instead of "capture.jpg"... this was also reported by someone else as a bug.

I can't put more time into this right now.. this project was just for fun. I'll do some more research in the future, maybe I'll look at your fork or revisit this again as well.

Thank you for your time.

Regards, -Moses

Patriboom commented 1 year ago

Sometime, it is as simple as too long delay for browser. Just refresh your page and the image may show up.

Patriboom commented 10 months ago

Did you find an answer ? Finally, on a forth aithinker ESP32cam, I encounter the same problem as you and can not solve it.