/public/img/ folder not acceping new assets in Go-compiled web app - go

I downloaded a binary via docker for the Gogs project (https://github.com/gogits/gogs), set it up (via docker pull gogs/gogs) and the server works as expected. Now I'm trying to customize the html a bit to look consistent with our company's other tools. When looking at deployed project, the assets of interest are in the following directories:
public/img/*.png
public/css/*.css
templates/*.tmpl
When I update the css, changes take effect right away, when I update tmpl, I need a container restart (implying that html is generated at server start time), when I update anything in public/img/ directory, however, I can't seem to get those assets used at all and I'm clueless about what's happening since most web servers/frameworks treat public/img/ as a static directory with all of its contents publicly visible by default.
Here is what I've tried so far and the outcomes:
Action: copied a new favicon image (my_favicon.png) into public/img/ and changed /templates/base/head.html to point to it (/img/my_favicon.png) instead of the original (/img/favicon.png), left original untouched and restarted the container.
Result: page loads with broken image icon, DOM inspector says that it's pointing to /img/my_favicon.png but doesn't show the image, going to that URL directly doesn't show the image either.
Action: change .tmpl back to point to original image (/img/favicon.png), overwrite original with the new image. I tried this with the main lg-gogs.png logo too.
Result: page loads with broken image icon just like before.
A grep search for image name revealed that only the .tmpl I modified and config.codekit are mentioning it (and I'm not at all familiar with CodeKit, but the instructions claim that it's only relevant for git, not me, and to leave the file alone, although it seems to profile names and sizes of all images - however I don't see anything else on the server reference this codekit file).
I have no idea why changes to css and tmpl work fine, but images cause this unexpected result. Does anyone have an idea of what's going on, why the server isn't accepting the images?

Related

Unable to retrieve new image on webpage

I am using Spring boot and I am still getting the old image in my web page after I swapped the image. I have cleared my browser cache, did a maven clean install and still no difference. I even changed the entire folder name where the images are kept and yet, I am still able to get the correct images when I should be getting nothing. I have double checked and it is definitely the correct path. There is no other images folder in this project to cause any confusion.
Please refer to image. The correct folder name should be "images". Instead I changed the folder name to "images1" to test and yet I get the correct images. I don't understand what kind of caching is going on here. Please advice how to clear it.

Impossible to reference an image from the Assets Folder

I am currently building a Windows Universal App and the learning curve is OK. I get a response from my webservice, parse the JSON, display info in the app, but my current issue is the following one:
I tried to display an image that I put in the Assets folder, but this doesn't seem to work.
This is my layout:
As you can see, the text "Test" is correctly displayed but not the images.
On the right side, in the explorer pannel, I cannot see the files that should be here:
WHAT I HAVE TRIED:
In my example, they are in the Assets/picto folder, but I have also tried the root directory Assets, as wal as creating Image folder at the same level.
I have definitely no idea how to add a simple picture, so any help is appreciated!
Adding items in Windows explorer to the right location doesn't add them to your solution / deployment.
You have to right-click the picto folder -> Add > -> Add existing item. Your items are not even in your solution, so they won't show up on the layout screen.
Make sure you set the correct build target for each image.
If an image shouldn't show up, even through it's in your solution, this is often the reason.

Website displays image that is not associated with img src

I have an iOS app that contains a UIWebView, which display a webpage. Sometimes the page displays a different image than the one associated with the src link.
A user sent me a screenshot where it was clear that one of the icon images had been replaced with a completely different image. The same wrong image was displayed in each of the instances where this icon was supposed to be displayed. Refreshing did not solve the issue, but closing and opening the app did. (Or maybe she actually deleted and reinstalled the app.)
The html for the icon is just an img:
<img src = "/the_icon_source">
The img src is hardcoded directly into the HTML file. I therefore don't see that the HTML itself could have been wrong or said anything besides "/the_icon_source".
So how can the wrong image be associated with an image src? Could the server be sending the wrong image when it's asked for "/the_icon_source"? Could the iOS app be caching incorrectly, mixing up images? How to test and fix?
I myself cannot reproduce this issue. I'm not sure how often it occurs, but several users have mentioned it, also for other images on the page. They have only mentioned it occurring in the app, not on the website. This may just be because the app is used more than the website.
My host is Webfaction and the images are served using WebFaction server’s static-only front-end nginx process. The app displays the website in a UIWebView. (Webfaction suppprt merely told me that they served the right images.)
Is the problem not that you have it like this:
img src = "/the_icon_source"
rather than like this:
img src = ".the_icon_source"
If this is sat on a linux server the / will be pointing to the root directory whereas the . or simply the_icon_source would simply point to the directory in which the website is sat which i assume is where the image is also located.

Image display/cut off issue when using Vagrant for HAML/SASS development

I'm making HAML/SASS changes for a Rails app which I'm running locally using a Vagrant/VirtualBox VM on Mac OSX (Snow Leopard), and I keep encountering a really odd issue whenever I make changes to an image referenced in any of the HAML/SASS files.
Here's an example of what happens:
I open a local Rails app page in my browser and all images are displaying correctly
I re-size an image (using Gimp) to make it smaller and save changes
I refresh the page to see the changes and the original image is still showing, but with the bottom cut off in proportion to how much smaller I made the image
I remove the image file from the directory and hard refresh the page to see what happens.
Sometimes the original cut-off image is still there, sometimes it disappears and I just see the missing image path icon
I move the image file back into the directory to try and force it to pick up the re-sizing
Sometimes this works first time, sometimes I have to do it 3 or 4 times before I see the correctly-sized image
Sometimes I see the old cut off image re-appear even after I have refreshed the page and seen no image!
The same issue seems to occur if I am making other changes to the image file (e.g. if I'm saving an entirely new image with the same file name). Apart from this image issue, all edits to HAML/SASS files work, and I can instantaneously see my changes.
I thought it might be some sort of browser rendering/caching issue, but similar issues occur in Firefox and Chrome. If I use Firebug I can sometimes see that the correct file is being picked up but it's not showing in the page itself.
I can only think that this has something to do with Vagrant. The only thing that is guaranteed to fix it entirely is restrating the Vagrant box, but that takes a long time.
I realise that this may not be a simple problem, as it may have something to do with our Rails app and configuration of Vagrant/VirtualBox, but I just thought I'd post the issue here in case anyone else has had similar issues.
Thanks!
What you're probably seeing is an issue that the VirtualBox shared folder filesystem has along with the sendfile syscall. You need to disable the use of sendfile on your webserver if you're serving files from a VirtualBox shared folder. Doing this is easy:
In Apache, add this to your configuration: EnableSendfile off
In Nginx, add this to your configuration: sendfile off;

Swapping an image during web development

I'm trying to see what a certain webpage would look like if I replaced a certain image with another. Rather than upload the image, edit the site, etc, each time I tweak it, I'd like to know if there's a way to change the image in the page to my local version while viewing the remote page.
I use Firebug for debugging web development usually, but I'm open to any other tool that might do this.
(It is absolutely impossible to search for this and find anything but questions about dynamic image swapping on a deployed website, so sorry if this is a duplicate.)
Added: I just tried substituting a file:/// URI pointing to the image (copied and pasted from the address bar after manually opening the image), and alas, it did not work — the image fails to change.
It seems to only work with the http[s] protocols (likely for security reasons). You can store your images on service like Dropbox, share the image or folder, then use the public URLs.
Really, you can use any web accessible images, so a local server would work too.
If your image is in a localhost server(not as file mind you) i think you can still put that localhost url in the firebug inspect element and it'll work.
Tried an absolute file path but it doesn't work apparently. So I guess you just have to make do with a localhost server image. That works for me
Quick and Lowtech Answer: Take a screen shot of the page open it in photoshop and drop the local image on a layer above the webpage image.
Hi if you are serving from a webserver, u probably can't point it to a file on ur local drive. Even if its localhost, u can't point to a local file c:/test.jpg for example. Its because the browser sorts of sandbox ur page so that scripts can't access local files.
One way is to upload the new file (new_file.jpg) to the webserver, give the image link an id
<img id="something1" src="test.jpg"/>
Using jQuery in the firebug watch window do
$("#something1").attr("src","new_file.jpg");
You should see the image change. If you are not using jQuery, you can use document.getElementById("something1") and get the element to modify.
Another way is to use http://makiapp.com/
You can overlay an image from you computer onto any website you look at with this. Very cool tool for lining up a comp with your code.
You can:
Drag your test image into Google Drive
Open it in a browser
Go to the actual image path
Use this path as a substitute in Firebug
It's almost as fast as working from a local drive.

Resources