Author Topic: Renaming JPG's  (Read 698 times)

0 Members and 1 Guest are viewing this topic.

Offline DAVE Z

  • Senior Member
  • **
  • Posts: 83
Renaming JPG's
« on: May 15, 2018, 11:33:51 PM »
Sorry, I am a real greenhorn so bear with me. I have two different cameras that can  upload images to my website. They both name their images by a time stamp. An example is a file with the name Cap2018515_210502d_1jpg which is 905 PM on May 15,2018. Every file  they upload has a different name. I need  the  camera FTP upload to give every file the same name and over write the previous file on my web server. But it won’t. Another problem is that the camera uploads a new  daily folder on my website every day. My website is written in HTML and points to a specific file in the same folder. I am now trying to hit a moving target.
            I thought about using a script and having my web server execute it every 5 minutes. I have never written a script and I don’t know what language to even try to learn. PHP seems popular.  Or is there a website a person can have a script written or downloaded? Or will HTML permit wildcards? I am not sure how to proceed.

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather
Re: Renaming JPG's
« Reply #1 on: May 16, 2018, 12:08:37 AM »
There is a thread here on the forum with a script to do the datetime file to a fixed file name, actualy I think there are a couple of threads.  I had that working for my Hikvision IP camera a couple of years ago.  Sorry, I can't search from my tablet.  Though not sure how the new folder each day would work.

Enjoy,
Paul



Offline Dane_B

  • Member
  • *
  • Posts: 41
    • WI3X Home Page
Re: Renaming JPG's
« Reply #2 on: May 17, 2018, 09:25:10 AM »
I guess first thing is to not have a new folder for each day. Is your FTP server connection in the camera perhaps set up to auto create a directory? If so, can you turn that off.

I do exactly as you want to do with a simple cron job (I'm no expert by a long shot) but it works.
Davis Vantage Pro2 Plus
UV and Solar sensors
Remote Wireless Anemometer
http://weather.wi3x.com/gauges-ss.htm

Offline Ian.

  • Forecaster
  • *****
  • Posts: 459
    • Chatteris Weather
Re: Renaming JPG's
« Reply #3 on: May 17, 2018, 11:10:24 AM »
Hi,

As Dane_B says, if you can disable the camera writing a new daily folder, then the way I have been shown will work.

The server has one folders and within this 3 other sub-folders, the 1st contains the .php script which does the magic, the 2nd is the folder where the renamed image lives and the 3rd folder is where the camera sends its image with the ever changing details.

I use cron-jobs.org to get the .php script to run every 5 minutes, what this does is copy the image from folder 3 into folder 2 and renames it to a name that doesnt change and after doing that, it deletes the image in folder 3.

Ive attached how my folder structure looks and the script .

Hope that helps.

Ian
CWOP - DW3371
PWS - ICAMBRID16
https://www.chatteris.biz

Offline DAVE Z

  • Senior Member
  • **
  • Posts: 83
Re: Renaming JPG's
« Reply #4 on: May 19, 2018, 01:43:01 AM »
Thanks for the script and advice. I will see if my D-LINK will stop creating new folders each day.

 

anything