Trendnet IP Camera + FTP Upload = Good Times
I purchased the Trendnet TV-IP212W IP camera recently. Nice thing about IP cameras is you can plug them in anywhere, they don't have to be tethered to a PC. I have some web space with ftp access so I wanted to have the camera upload images to the web, triggered by motion.
Setup is easy enough, pop your ftp credentials in the admin screens and you're good to go.
The 1st problem I ran into is the camera will create subdirectories on the ftp server based on the current date, today would be: 20090327, tomorrow: 20090328 etc... This is a pain for anyone wanting to throw a little web page together to show the image files uploaded as you're now getting into trying to figure out dynamically what folder to look in.
The 2nd problem is there is no image count or space threshold that can be setup. You turn this on and it will continue to upload files until there is no space left on the ftp server.
So I put a little index.php PHP script together. You drop it in the root directory where the subdirectories are being created and where you'll be viewing the images from. The script does the following:
Hopefully a future firmware update will add some FTP options to control these parameters for people with less scripting knowledge.
Setup is easy enough, pop your ftp credentials in the admin screens and you're good to go.
The 1st problem I ran into is the camera will create subdirectories on the ftp server based on the current date, today would be: 20090327, tomorrow: 20090328 etc... This is a pain for anyone wanting to throw a little web page together to show the image files uploaded as you're now getting into trying to figure out dynamically what folder to look in.
The 2nd problem is there is no image count or space threshold that can be setup. You turn this on and it will continue to upload files until there is no space left on the ftp server.
So I put a little index.php PHP script together. You drop it in the root directory where the subdirectories are being created and where you'll be viewing the images from. The script does the following:
- Delete old directories. Any image directory that isn't today's is deleted. The is_numeric() check makes sure we're only looking at the image directories that are numerically named. This allows you to have other directories in here as needed outside the scope of the image directories.
- Iterate through today's image directory, popping the jpg filenames in an array.
- Sort the array in reverse order. The filenames are numeric based on the time the image was taken, making sorting easy...
- Pump html out to the screen, loop through the image array. I have it set to only show the last 12 images, any older ones are deleted.
Hopefully a future firmware update will add some FTP options to control these parameters for people with less scripting knowledge.

