ESP32 Loading .jpg images into flash memory SPIFFS

Hello.
Can you tell me how can I save 5 images to flash and then delete after 10 seconds?

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spiffs.html

Hello.
Can you tell me how can I save 5 images to flash and then delete after 10 seconds?

What have you tried ?

Please post your full code without line numbers

UKHeliBob:
Please post your full code without line numbers

How can I save 5 pictures, then delete the old ones?

How can I save 5 pictures, then delete the old ones?

Do you need all 10 images to be in SPIIFS before you delete the oldest 5 or could you just read in a new file and have it replace the oldest one ?

Is it OK to reuse filenames or must each file saved have a new unique name ?

OK. What have you tried ?
Start by creating 5 files and sending them if you have not already done so

The ESP32 SPIFF API has some really great examples SPIFFS Filesystem - ESP32 - — ESP-IDF Programming Guide latest documentation of how to use SPIFF.

Hello.
Can you tell me how can I save 5 images to flash and then delete after 10 seconds?

#include "SPIFFS.h"


int i;
char aniImage[12];
 
void setup() {
 
	Serial.begin(115200);
  
} 
void loop() {
  if (!SPIFFS.begin(true)) 
  { 
    Serial.println("An Error has occurred while mounting SPIFFS");
    return;
  }

  File root = SPIFFS.open("/");
 i++;
  File file = root.openNextFile();
 sprintf(aniImage, "/d%2d.jpg", i);
 Serial.println(aniImage);
  if(i == 5)
{

  for (int i = 0; i < 2; i++)
  {
    Serial.println("remove");
    SPIFFS.remove(aniImage);
  }
}



if(i == 5)
{
  i = 0;
}
  delay(2000);
  }

This topic has been merged into ESP32 Loading .jpg images into flash memory SPIFFS.

Duplicate threads merged

Duplicate posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated duplicate posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

@zarar384

TOPIC MERGED. ( again ! )

You now have 48 hours to follow up and read the links below !

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum.

Thanks for your co-operation on behalf of The Arduino Team.

"Hello.
Can you tell me how can I save 5 images to flash and then delete after 10 seconds?"

You can look at the SPIFFS functions available for the ESP chips (fairly easy to find using a google search) to see if they fit your needs.