google app engine - Created HTTP response to be the same as accessing .jpg in Python -
i want server image file accept attributes processing before hand using python , google app engine.
where have
'http://www.domain.com/image/desiredimage.jpg'
as image server.
i want able add tracking can similar to
'http://www.domain.com/image/desiredimage.jpg?ref_val=customerid'
i figured best way have "proxy" image requests like
'http://www.domain.com/imageproxy?img=imgid&ref_val=customerid'
and have imageproxy url process ref_val value , serve image based off imgid value datastore db.blob value.
when access proxy url shows image , processes fine. when used url in other 3rd party javascript json requests looking image url, nothing show up.
i guess root of question how accessing
'http://www.domain.com/image.jpg'
different accessing
'http://www.domain.com/script_that_returns_image'
where latter url python script outputs
self.response.headers['content-type'] = 'image/jpeg' self.response.out.write(image) #image db.blob property in google app engine
could couple issues. overloading image , providing arguments if script, might triggering javascript sandboxing/security stuff meant prevent cross-site scripting attacks.
another issue might 'dumbness' of client app, clients might expect '.jpg' regardless of content-type.
open javascript console , see error you're getting on image in question first step.
alternatively, might want more devious how you're encoding uniqueness element, instead of making cgi-ish, try like
http://domain.com/image-ref_val-customerid.jpg, customerid dynamically updated.
Comments
Post a Comment