Hi, I start with the Project “Photo-Manager” (eBook).
My question:
How can I adjust the image size (smaller) for the "ESP32-Cam PhotoManager" project so that the photo fits on the PC screen?
Thanks
4 Answers
Hi.
The easiest way to do that is to adjust the image size on the HTML.
In your code, search for the following:
<img src="saved-photo" id="photo" alt="Image not found: failed to open
image, image deleted or no microSD card inserted. Try refresh the page
or restart your board.">
Then, add the width and height attributes to set a fixed width and height. See the example on the following link to learn how to set width and height:
So, in your code, you would have something as follows (replace the 500 and 600 with the appropriate values for you):
<img src="saved-photo" id="photo" width="500" height="600" alt="Image not found: failed to open
image, image deleted or no microSD card inserted. Try refresh the page
or restart your board.">
I hope this helps.
Regards,
Sara
Thank you for your quick response. Unfortunately, this was not the solution we were looking for, as the reduced photo was still drawn to full width. But with your tip I found the solution:
<style>
body {text-align: center; }
.vert {margin-bottom: 25%; }
.hori {margin-bottom: 0%; }
img {height: auto; width: 80%; }
</style>
I changed width: 80% . So it works now.
Many thanks and best regards Ulli