Well, my problem is that when I add the "?guest=true" in the end of the image url, alfresco logs me out as admin and logs me in as guest. Is this a bug in Alfresco?
This is actually expected behaviour, when you put guest=true you are logging in as the guest user so the session you had as admin has been lost, hence the requirement to re-login.