I am looking for an answer here, and I think I already described this, but perhaps I did not do a good job, so let me try again.
The working scenario is that the update page is updating a record that already has an image associated with it. The update page uses resize code to display a smaller version above the file field (so the user knows what the current image is). The user inputs a new image to replace the old one. The form is submitted.
The header PHP code:
- Loads the includes,
- Creates the recordset for the update transaction,
- Uploads the image,
- Executes a conditional statement that determines if a new image has been uploaded to replace the existing one,
- if true, deletes the thumbnails
- Executes Update Transaction 1 which updates the image field if a new image has been uploaded,
- Executes Update Transaction 2 which updates and other changes and redirects to the update page (so presumably none of the pages body code is executed which is where the thumbnail generation code exists)
When the page is redirected, the record is already updated, so it should load the new file name and create thumbnails for the new image, SO WHERE IS THE CODE THAT CAUSES THE OLD FILE'S THUMBNAILS TO BE RECREATED AFTER THEY ARE DELETED?
Now the page is using a framework theme, but I tried removing the framework code and the same thing happened. I have not told it to delete the old full image yet, which I will try shortly, but to avoid throwing errors, it would still be good to understand what is happening here.
The includes for the image resize and framework have remained included throughout, so when I say I removed code, I mean all the active code in the page, not the includes.
I suspect it may have something to do with output buffering from one of the includes, but it still is not completely clear.
In short, the thumbnail code is all below, and the update transaction should redirect the page before the thumbnail code executes. Any light that can be shed on why the resize code is getting executed before the update transaction redirects the page and any fix/workaround for that would be greatly appreciated.