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
JavaBot
JavaBot11mo ago
This post has been reserved for your question.
Hey @userexit! Please use /close or the Close 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.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
userexit
userexitOP11mo ago
!help
dan1st
dan1st11mo ago
What exactly happens? "doesn't work" isn't really precise
userexit
userexitOP11mo ago
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
dan1st
dan1st11mo ago
resources should be somewhere in src/main/resources Do you want to statically serve images?
userexit
userexitOP11mo ago
nono
userexit
userexitOP11mo ago
I was serving resources from
No description
userexit
userexitOP11mo ago
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
userexit
userexitOP11mo ago
now I just gotta find how to put the fonts there too and its all good
No description
userexit
userexitOP11mo ago
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
dan1st
dan1st11mo ago
that doesn't get copied anywhere these aren't included in the JAR Generally, File is for stuff outside the JAR
userexit
userexitOP11mo ago
ah damn what about fonts u think i must use google cloud storage too or can i put that in resources/fonts @dan1st | Daniel
dan1st
dan1st11mo ago
you can just put files in src/main/resources and load them with getResource NOT with File/Path
userexit
userexitOP11mo ago
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
dan1st
dan1st11mo ago
idk what you want to do
userexit
userexitOP11mo ago
. i have a shop i sell football clothes
dan1st
dan1st11mo ago
if these should be part of your application, I would put them in src/main/resources
userexit
userexitOP11mo ago
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
dan1st
dan1st11mo ago
use whatever you prefer oh and privacy may be a concern as well
userexit
userexitOP11mo ago
wdym
dan1st
dan1st11mo ago
if you use stuff hosted by Google, then Google gets the IP address of your users
userexit
userexitOP11mo ago
if I host it on my pc then im the one getting it i think anyways they would trust google over me 😂
dan1st
dan1st11mo ago
¯\_(ツ)_/¯
userexit
userexitOP11mo ago
InputStream fontStream = RequestFilterResults.class.getResourceAsStream(fontPath); this is how you do it for streams right
dan1st
dan1st11mo ago
yes
userexit
userexitOP11mo ago
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
JavaBot
JavaBot11mo ago
Post Closed
This post has been closed by <@1200560437331239014>.

Did you find this page helpful?