I am using Flask to build an Azure bot with botbuilder library, and I use a local image in a herocard. However, when I go to my source code and change the content of this local image or even delete this local image, the bot still sends a herocard with the old image. Why it happen and how to fix it because I need to change the content of the png file for a user input?
Related
I am trying to overwrite an image in my Cloud Storage over the Python API, but after I overwrite it and refresh (and delete browsercache) the Cloud Webpage or the public link the image is still the same, even the next day but sometimes it gets randomly updated to the new image!
Edit: The Metadata get updated, but not the filesize-info and it still shows the old image in the Cloud-Webpage and at the public url.
What I am expecting is that if I am uploading a file to Cloud Storage via a API that I can download the new file from the public link a short time afterwards instead of the old image.
I expected to be able to define the cache behaviour with the Cache-Control File-directive (Edit: it is propably not an issue about caching because even the next day the image stays the old one).
This is my code:
blob = bucket.blob(name)
blob.cache_control = "no-store"
blob.upload_from_filename(name)
I tried:
Deleting the old image over the Cloud-Webpage and then after a few
seconds upload the new image with the same name via Python: It works!
I can download the new image from the public link and see it in the
Cloud-Webpage. Edit: It seems to work only some times!
Deleting the Image with Python and directly afterwards upload the new
image via Python: Not working. While it is deleted the public link
doesnt show it. But after I uploaded the new one the public link
shows the old one again.
I read that the standard cache settings of public bucket files is
"public, max-age=3600". So I used the Cache-Control Directive and set
it to "no-store" or "public, age=0". Then I confirmed these
Cache-Control settings are reflected in the headers in the browser
debug console. But still the old image is loading anytime.
I changed the bucket type to regional instead of multi-region. Even after deleting the bucket, recreating it and moving the data inside it again the old image is still showing up!
Any tip is highly appreciated!
I made it work!
It was propably not related to Google Cloud Storage.
But if someone might did the same mistake as I:
I used Django's FilesSystemStorage-Class and saved the new file with the same name as the old one in the /temp directory, assuming that the old one will be overriden if it still exists. But instead it gives the new file another name. And later I upload the old file with blob.upload_from_filename(name)
Thats why all the things happend so randomly.
Thanks to all who thought about solving this!
I created something on the canvas and want to save the image, I used to use the Save () method (in Pil too). But the problem is that hosting (which I use) cannot be stored (I don't even know why), and so I would like to make a ready -made image that I created in the URL, because otherwise I will not send it to the user. Which library should I "get to know" to implement?
I recently created an application where I tried to add a Presence (Discord Status) to it...
But how do I get the Large_Image_Key, but where do I upload the images
Here's the Script:
RPC = Presence('764214583510433872')
RPC.connect()
RPC.update(state="Using Out-Standing", large_image='outstandinglogo', start=time.time())
You will have to go to the Discord Developer portal.
https://discord.com/developers/applications/
Create an application.
Now you'll will see a client id, if you click on that application.
That's your client_id.
Under application settings, go to Rich presence >
Art Assets.
Now you can add images by clicking on the Add image button.
Note: Make sure that your application is not running when uploading images.
The name of the image you upload will be your key.
Now, you may use this as your large_image_key/ small_image_key.
I have seen examples in Google's DialogFlow where "Cards" are output and an image is shown to the user. I am using Python as a backend, with ngrok hosting a local website to connect the webhook to Google's fulfillment. However, these cards require an image's URL to show the image after an intent is activated. I am using matplotlib to generate a plot, which is saved locally. I want this image to be displayed after an intent is achieved.
Would it be better to immediately save this plot online somehow, or to send it to ngrok's server for me to use in fulfillment? Or is it possible to just upload the local file?
I created new directory via 'myimages' under static directory. And whenever user upload files, file get stores in that directory. Once file uploaded I can access that on html using '/static/myimages/imagename.png'. It works fine whenever I am uploading new image. But whenver I try to override image. It shows me old image only.
I manually check in directory. It has new image, but still when I try to access that via browser, it gives me old image.
This sounds like your browser is caching the images. Try setting the cache_max_age=0 on your add_static_view, or viewing the page in your browser's incognito mode where it'll use a different cache.