Here is parts of my view code (haml):
%link{rel:'stylesheet', href:'/screen.css', type:'text/css', media:'screen'}
%img{scr:'/tile.jpg'}
The ./public folder contains files
screen.css and tile.jpg
Problem is image do not appear on the page. At the same time css file successfully applies
I also tried to put tile.jpg into ./public/images but nothing changed.
Webserver - thin, sinatra app.
You might want to give the Sinatra Static Assets gem a try. I've started using it for much the same reason, it means I don't have to remember the HTML attributes quite as much (though still a bit) and it should cut down on typo errors a bit too.
Related
I am currently having an issue with Github Pages
I guess it doesn't hurt to use the actual live example
The corresponding repo is https://github.com/ScottA38/ScottA38.github.io
I made some styling changes (maybe some JS changes I don't remember) ages ago when I was actively working on the content, and somehow ever since the 'projects' page has been 404 when I try and click through to it from the menu.
I am using Jekyll theme Jam which is some obscure obsolete theme, but I don't see it being a problem really
The strangest part is that if I load the site locally with bundle exec jekyll serve then this page appears perfectly at localhost:4000/projects, just not on the live site
If I put https://scotta38.github.io/projects.html (live site) it also appears perfectly, just not at https://scotta38.github.io/projects like I want
I have seen some suggestions about GH servers caching an old version or something like this but I don't really understand and I need some guidance
"About" page works and you have a permalink there, but nothing for projects.
Probably adding
permalink: /projects/
will fix the issue.
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?
Are include files, such as server side include SSI, files necessary in an html website?
I recently tried to host my simple html website through GoDaddy. I used Dreamweaver CC to upload my files and encountered a problem. Some of my pages were not displaying images or css. I checked to see if the images and css were on the server and in the correct places and they were. Confused, I called GoDaddy's customer service, waited 35 minutes, and talked to one of their customer service reps. He basically told me that it may be my code and that I need 'include' files.
I have looked all over the web and I'm still not entirely sure what an include file is... I got from my research that they are snips of code that call images/files without having to write out the same thing on every page. If I have copied and pasted the same thing on every page, why then would I need an 'include' file? I previously had my website hosted through Hostmonster, still do now, and I have never had to alter my code...
I am still new to the world of coding, so please be kind. If anyone knows of a good resource to help explain the use of 'include' files please post it or correct me if I am wrong. Thank you.
I think the GoDaddy "support" guy was talking about the include operation in your html files that you need to fetch your css files.
Presumably your web pages work correctly when you display them locally on your development machine -- the machine where you run Dreamweaver. If not, fix them. They'll probably need css files in some subdirectory (or maybe in the same directory as the html) and image files in some other subdirectory.
Open up your page, on the server, in a browser, and then do View Source. Look for your css file download commands ... which may look something like this ... in your source.
<link href="styles.css" rel="stylesheet" type="text/css" />
Are the links (the href items) what you thought they should be? Sometimes you'll find that they are absolute links like
file:\\d\myfiles\website\dreamweaver\some_other_junk\styles\foo.css
If they are you need to change them to
styles/foo.css
The same goes for images.
And, no, you don't need server-side include files to put up a working static web site.
I have a Ruby app which is an Image Resizer. It uses the RMagick gem to do this. The app asks the user to upload a file, and then resizes it and saves the newly generated file.
It seems that Sinatra by default puts all uploaded files into the 'uploads' directory, and the newly generated file also seems to be saved there. I am assuming this is default behavior, not sure how to change this, but it isn't an immediate problem at the moment (although if you know how to do this, that would be appreciated too).
Now, in my 'success.haml' page which is displayed after the file is generated correctly, I am trying to display the newly generated image with a simple img tag. The path to the file is found in #filepath, so when I did:
%img(src=#filepath)
the HTML rendered (when inspected using Firebug) is correctly showing
<img src="uploads/filename.jpg">
and this file does indeed exist in my folder structure. However, the image appears broken.
Any ideas on how to overcome this problem?
Thank you.
Relative urls (uploads/filename.jpg) are called so because they are relative to web root. In Sinatra this is the public folder. By default it's located in your app directory and called public. But you can override that.
set :public_folder, 'my_root' # this will make my_root dir the web root.
So, to make your uploads visible to the internet, put them into your public folder.
Read this for more Sinatra settings and customizations.
I have downloaded WkHtmlToXSharp (which uses WkHtmlToPdf under the hood) and opened the solution.
When I run the test given with the project - CanConvertFromFile, it gives me a nicely formatted PDF output.
But as soon as I delete even a blank space from the source HTML file ( WkHtmlToXSharp.Tests\Resources\page.xhtml) it renders only text with no HTML structure in place i.e. all text on the page is rendered as a single line.
I am finding the same problem with my dev project using WkHtmlToXSharp.
I suspect this is due to change of character encoding of the source file. Do you know what the character encoding should be? Is this an issue with WkHtmlToPdf as well?
Note: Sorry for the slightly misleading tag (WkHtmlToPdf), the site did not allow me to create tag WkHtmlToXSharp.
Many Thanks!
wkhtmltopdf assumes UTF8 as default, but there's a property (WebSettings.DefaultEncoding) which can be used to override the encoding expected.
However, your problem looks more like you are re-using a disposed instance or something similar. May you describe a bit deeper your use case.. is it an ASP.NET application? a console project? are you running under visual studio's dev web server?
I believe the cause of this is in the issue tracker on Pablo's repo. Issue #7: Only works first time
datimson commented 25 days ago
Also, for the sake of helping anyone else who might have this problem, when debugging with WkHtmlToXSharp in ASP.NET you need to stop the ASP Development server before restarting or rebuilding the application - this is what was causing my text only PDF outputs.