Jump to content

Automated Script To Switch Image Files On Website?


Recommended Posts

Well hello again!

I'm developing a website for a company and they have requested to have two "templates" of sorts..

One for spring/summer and one for autumn/winter. The switch between the templates only consist

of some replacements of image files. So it's not that sophisticated, however I've became quite busy these days

I'm looking for a script to automate this process. Preferably I'd like it to run server-side, however it won't be

an issue if not.

Does anyone know any software for this purpose? Maybe you could automate two FTP actions to run on certain dates?

Thanks! :)

Link to comment
Share on other sites

Add the image urls to a script or if the site supports PHP, do it on the backend with an if statement to call which image you want. Get the current date and if the month is say less than 6 show image 1, if its greater than 6 show different image. Adjust according to your needs obviously, like having ranges, if 1-3, show image 1, month 4-7, etc, etc

Link to comment
Share on other sites

Here is an example, of how you can change a picture with PHP

Demo: http://demo.marcofolio.net/php_random_image_rotation/

Source code: http://downloads.marcofolio.net/programming/webdesign/rotate/rotate.zip

This PHP script, works by rotating the images every time the page is refreshed. In order to get the images, rotated by date/time the script will need to be slightly modified.

Edited by Infiltrator
Link to comment
Share on other sites

Excellent, thank you for your suggestions.

However there might be a problem with this script since the images are not embedded using plain HTML because I am using them in a

jQuery script (slideshow). Although this should probably work anyway if I just point the jQuery script to for example: <img src="http://example.com/rotate.php?img=gorilla.jpg">

Hmm not sure how well php and javascript plays toghether in this matter, well I'll just try to configure the script and report back to you once I have a result :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...