Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5937017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:28:49+00:00 2026-05-22T15:28:49+00:00

I have a simple PHP script using imagecreatefromjpeg to create a thumbnail version of

  • 0

I have a simple PHP script using imagecreatefromjpeg to create a thumbnail version of original and save it to a new folder. To speed parsing (all done in the back end prior to upload to static site) I am using file_exist before the creation to check it exists and show – if not create new and show. This works fine but if the original image changes the script does not generate as the thumbnail image exists in it’s old form.

I guess I need to use MD5 test but as a n00b not sure how to test if the resulting thumbnail version would be different from the existing as produced by the main image.

Current Logic:

if thumb exist == do nothing,
if thumb does not exist == create it

Additional logic

if thumb will change due to change in original == create it,
if thumb will stay the same == do nothing

The existing PHP is very poor and clobbered together so happy for any pointers from a fresh (expert) view.

Thanks, John

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:28:50+00:00Added an answer on May 22, 2026 at 3:28 pm

    You want to check the time the file was modified.

    http://php.net/manual/en/function.filemtime.php

    if the original file’s timestamp is newer than the thumbnail’s timestamp, then make a new thumbnail.

    Thanks guys – not sure if that will work if the original image was created previously but only just being used eg stock images that are on file elsewhere and then dragged into the /images/ folder to replace existing image but with the same filename.. does the timestamp show the date dragged or when it was created?

    If you move the files, the modified timestamp does not change.

    If you copy the files, the copies are created by the copy action.

    When you create a file, its Date Modified timestamp is the same as its Date Created timestamp.

    So if your drag is copying the files, then the modified timestamp is the timestamp of the moment that the files were copied.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple php script on a server that's using fsockopen to connect
I have this simple php script <?php echo '<pre>'; // Outputs all the result
I am pretty new to php, but I am learning! I have a simple
I'm trying to write a simple PHP script which automatically sets up new etherpads
I've got a simple php script to ping some of my domains using file_get_contents(),
Heres a simple php script that generates some XML: <?php // create doctype $dom
I have a simple PHP script that sends a message to a specified email
I have some code I've written in PHP for consuming our simple webservice, which
Ok, i have simple scenario: have two pages: login and welcome pages. im using
I have a strange issue. I'm trying to write a simple php webpage on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.