Jump to content

best way to delete certain images with a cron


dadamssg

Recommended Posts

I have a database that stores events and it works fine. I do a cron to delete all the events that have ended. But now i'm developing an image upload feature for an event. So...someone creates an event and now they have the option to upload a picture to accompany it. As the pictures are completely separate from my database, i can't figure out the best way to delete them. Cause i want the pictures to be deleted along with the expired events and a cron would be excellent if i figure the theory out. Anybody have any ideas?

Link to comment
Share on other sites

But now i'm developing an image upload feature for an event. So...someone creates an event and now they have the option to upload a picture to accompany it. As the pictures are completely separate from my database

There has to be some sort of way you have related the images to the events? How for example do you show the images that are related to a certain event?

 

If you don't have any relation what's the point of uploading an image for an event if there is no relation to begin with?  :shrug:

Link to comment
Share on other sites

when they upload the image...i rename it then put that name in my database in the row for that event. I have a column field "Picture". an example text in it would be something like "1248324900LAdmin456.png"

Do you mean you have a table for your events such as:

events

- id

- name

- description

- date

- picture

 

If that is the case why don't simply do a select query to fetch the image name and delete it with that information?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.