NetTalk Central

Author Topic: Image Caching?  (Read 4673 times)

billbarker

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Image Caching?
« on: March 02, 2015, 05:36:36 AM »
I'm writing a membership system, that needs to hold a photo for each member, so I ask the user to upload a photo. This works fine..... UNTIL...

I now decided to change the photo name to be the unique identifier for each member, so there is no naming issues (and I will only be holding ONE photo for each member anyway).

I'm getting problems when I upload a second photo to OVERWRITE the existing photo... the file uploads ok, and gets stored in the 'uploads' folder, but the form does not refresh with the new image - EVER!!! I can close down the browser, close down the server, delete the file from the 'uploads' folder, but still the ORIGINAL photo gets displayed!

Maybe I've misunderstood the renaming process (code which I find strangely gets executed TWICE, once on pressing the 'upload' button, and once pressing the 'save' button).

I'm not sure if the attached screenshots help, but this shows I originally uploaded (and renamed) a file containing the 'image' of the word TWO - I then went back into the form and uploaded an file with the image of the word THREE - which is NOW the file stored in the 'upload' folder - however the image PREVIOUSLY uploaded is being displayed on the form.

(usually by this point, the exercise of trying to define the problem shows me my glaring error - but not in this case!)

Any help would be appreciated..

Thanks
Bill


[attachment deleted by admin]

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Image Caching?
« Reply #1 on: March 02, 2015, 12:03:54 PM »
Hi Bill

This topic has been canvassed here:

http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=6166.0

The critical point is that the rename code needs a wrapper which test whether the code is being executed because of the file upload or the save.  The code is shown in the thread.  There are other factors but this and the NT version you need to be at are the important ones.

Now, I still have an additional problem which may not be related that the image uploads and displays work 100% when testing locally but the images NEVER display when I move my app to a web server where the path is different - but the fully qualified name iw generated correctly.

HTH

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

billbarker

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: Image Caching?
« Reply #2 on: March 02, 2015, 03:42:21 PM »
Keith,

Thanks for the reply.

I've read the thread, and the 'multipule' execution does not really effect me that much, as the code could be executed 10 times, and I would still return the same file name (as I am just extracting the path, and the subscript, and adding in the 'middle'.... it's the actual image that's getting displayed that's causing me the 'issues'..... well not yet anyway, but would be if I went live with this!

Just a 'note' on your problem... are you ticking the 'remove full path' (or whatever the actual option is) from the 'upload' field, so only a 'relative' path for the image is held?

Bill

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Image Caching?
« Reply #3 on: March 02, 2015, 07:26:36 PM »
Bill

What you have described indicates that the value of PLA:PHOTOFRAME after the second (overwriting) file has been 'uploaded' is not being changed to the new file name.

So, if the first photo was <path>\12345.jpg and the second was <path>23456.jpg - that the file 23456.jpg is moved to the folder but the name in the field is still 12345.jpg

You've probably done all this but just check that the file field has changed.  It wont display immediately (after the upload) unless you 'reset' the Image field and it wont change the file value unless you Save the Form.

My comments are probably trivial but I've been down this track and know how frustrating it is.

Cheers

Keith

Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

billbarker

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: Image Caching?
« Reply #4 on: March 03, 2015, 12:22:39 AM »
Keith,

I may not come across very clearly in the original screenshots, but the value of pla:PhotoFname does not change, this always remains simply a reference to the players Unique Reference number, it is the image file (on disk, in the web/uploads folder) that changes, which for some reason I cannot fathom, the displayed contents don't change.

Bill

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Image Caching?
« Reply #5 on: March 03, 2015, 01:28:23 AM »
Hi Bill,

Is the "first image" cached in the _browser_ ?
(It might also be cached by the server, but restarting the exe would have illustrated that, so I think maybe it's cached in the browser.)

Pressing Ctrl-F5 on the address bar may help - or at a push just clear the browser cache. (This isn't a long-term solution - I'm just trying to determine if this is indeed the root problem - once we've confirmed that we can chat about possible solutions.)

Cheers
Bruce

billbarker

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: Image Caching?
« Reply #6 on: March 03, 2015, 06:37:28 AM »
Bruce,

Def cached in the browser... I have :-
  • Loaded new image - old image still there
    'F5'd browser - old image still there
    closed the browser and re opened  - old image still there
    closed the server, re-run server, opened browser - old image still there
    cleared browser history, restarted sever, opened browser.. Success

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Image Caching?
« Reply #7 on: March 03, 2015, 07:18:31 AM »
ok, first thing to try,
in WebServer procedure tab, Performance tab, turn on the option to auto check the cache.

cheers
Bruce

billbarker

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: Image Caching?
« Reply #8 on: March 03, 2015, 07:27:48 AM »
Bruce,

It looks like that was already set to 'true' (see attached).

While I was there, I tried turning off the 'Enable File Cache' - but this made no difference.

Bill


[attachment deleted by admin]