/    Sign up×
Community /Pin to ProfileBookmark

Image get delete after 6 month.

How do make a image to be deleted after 6 month if the image is not been view by people?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@moondanceMay 16.2004 — this is completely off the top of my head, but i'd try something like this:

-alter or create your database structure to include a field that holds an integer value of the number of times a pic has been viewed.

-everytime a picture is viewed/ downloaded, increment this number by one

-i think you can use cron to perform tasks on a webserver at timed intervals. i don't know much about this, but if you can use cron with php, write a script that retrieves all pictures with a NUM_TIMES_VIEWED (or whatever you called the db field) value that equals 0 from 6 months previous to now.

-then loop through this result set deleting each picture.

hope this helps
×

Success!

Help @tanfwc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...