The short answer is you can also delete the thumbnail image here, but if you have thumbnail, then you're using the Smart Image Processor. With a thumbnail image, you are going to have to format the imagename string so that you can add the _small after the filename and before the extension. than you'll need to add lines of code to name and delete the image. You would do this in the same code block that deletes the primary image.
TIP: You can find the code to format the thumbnail name in my FSO Thumbs extension.
I am trying out your tutorials and they all work great for me. Thanx for that! Really great.
I have 1 question though about using this tutorial.
Along with the image that i want to delete on update-action I want to remove the uploaded thumbnail aswell (filename_small.jpg). Is this possible and could you show me how to realize this? I have seen other peoples do this whole procedure with (a) different script(s) then used in your tutorial, but I find your method makes most sense to me...
I hope you can help me out... If not Still thaanx for getting me this far!
Wayne, after messing around with it, I realized that your code works just fine. I'm sorry for creating the confusion here but if users are applying this code, they have to make sure they have not applied the "Delete File before Update" behavior from the add-on pack since this chunk of code does it already. Having the add-on pack behavior will duplicate your function and create the error I mentioned.
Which is precisely why I stated that it needed to be updated. The add-on pack does not have a "delete image" function. However, I did figure out that all that is needed is to remove the "delete file before update" routine and it should work fine. In fact, this chunk of code should be the one in the add-on pack.
The other thing to check in the code is to ensure that the code calling the recorset with the image is placed before the update routine on the page. Most times the PU and update code is placed before the opening of the recordset by Dreamweaver. If the code to open the recordset isn't placed above the update code, it will also cause an error.
This particular chunk of code needs to be updated to work with the add-on pack.
Because the add-on pack has a "delete file before update" function, a user will encounter an error if thrying to replace the image because the add-on pack code will delete the file. The routine in this piece of code will then generate an error because it is trying to find a file that doesn't exist.
The code itself also does not delete the image anymore because the routines have been modified by the add-on pack.