Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Chat room not working Reply To: Chat room not working

#179971
__
Participant

Now i am deleting that file from my database if it is not what it is supposed to be. Is the file still a problem.

No, you’re not.

  • imagedestroy works on image resources; it has nothing to do with files.
  • You are still saving the file to disk, before deciding if it is safe to do so.
  • None of the code you’ve shown involves a database at all.

If you want to do this, here’s my advice: throw away all this code, and write out an outline of how you want the script to work using psuedo-code (“fake” code). There is enough going on here that you need to have a firm understanding of the process before you start trying to code it.

Start with something like this, and start filling out the details. Again, not real code, just a description of what you’re doing. As you figure things out, add note of which functions you’ll need to use, what arguments you need to figure for them, and so forth.

if( file was uploaded ){

    check file type

    if( file is an image ){

        create an image resource from it

        apply your filter effects

        save the resulting image

        (save the original file too?)
    }
}