I deploy my app to google cloud platform (java spring)
I deploy the app to google cloud platform and the images i generate suddenly dont work, but when It is locally it works, anyone that can help me
27 Replies
⌛
This post has been reserved for your question.
Hey @userexit! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
!help
What exactly happens?
"doesn't work" isn't really precise
I get 0 bytes of info from the images
I thought its maybe because since I coded spring locally
I didnt take in account for loading the images online
so I puyt them in the root folder
i thought mvn would
package them up in google cloud too
but apparently u must use cloud storage
so yeah
resources should be somewhere in src/main/resources
Do you want to statically serve images?
nono
I was serving resources from

I was basically doing
File asd = new File("allemagne21.png");
but I got empty answers from spring boot so I knew it was server sided issue
Im not even sure my new approach will work
now I just gotta find how to put the fonts there too and its all good

although I would have preferred
if these things could have been compiled with the .jar
increases speed
but i guess this way
i afford to just upload an image in google cloud everytime
instead of recompiling
so yeah
that doesn't get copied anywhere
these aren't included in the JAR
Generally,
File
is for stuff outside the JARah damn
what about fonts
u think i must use google cloud storage too
or can i put that in resources/fonts
@dan1st | Daniel
you can just put files in
src/main/resources
and load them with getResource
NOT with File
/Path
what do u think is better
the way im doing it rn with google cloud storage
i mean for speed the answer is obvious
but for lets say if every day i add 3-4 images
idk what you want to do
.
i have a shop
i sell football clothes
if these should be part of your application, I would put them in src/main/resources
i want to put their names on the tshirts etc
and preview
no thisi s just a site
online site
where i type for example
dan1st
20
and i get that image there
use whatever you prefer
oh and privacy may be a concern as well
wdym
if you use stuff hosted by Google, then Google gets the IP address of your users
if I host it on my pc then im the one getting it
i think anyways they would trust google over me 😂
¯\_(ツ)_/¯
InputStream fontStream = RequestFilterResults.class.getResourceAsStream(fontPath);
this is how you do it for streams right
yes
Font writingStyleName = loadFont("/fonts" + fontName + ".ttf", 65);
so this here will load successfuly this:
C:\Users\judoj\Documents\corrigerascii\demo (1)\demo\src\main\resources\fonts
Post Closed
This post has been closed by <@1200560437331239014>.