I use all of these:
1. body{ background-image: url('example.png') background-repeat: repeat;
2. body{ background-image: url('assets/example.png') background-repeat: repeat;
3. body{ background-image: url(<%= asset_path 'example.png') background-repeat: repeat;
4. body{ background-image: image-url(<%= asset_path 'example.png' %>) background-repeat: repeat;
5. body{ background-image: image-url('example.png') background-repeat:repeat;
6. body{ background-image: image-url('assets/example.png') background-repeat:repeat;
run assets:precompile
not working all, how to solve this problem, why not working?
Number 5 is closest to the correct syntax. Is it because you're not terminating your first CSS rule with a semi-colon?
body{
background-image: image-url('example.png');
background-repeat:repeat;
}
That should work - note the semi-colon at the end of the background-image line.
Alternatively, merge them into a single rule:
body{
background: image-url('example.png') repeat;
}
Related
Hi everybody I'm developing a CRUD system for a back-end webapp, I've installed tinymce and in the edit page I put the script for it.
<script type="text/javascript">
// Initialize your tinyMCE Editor with your preferred options
tinymce.init({
selector: 'textarea',
height: 200,
theme: 'modern',
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount imagetools contextmenu colorpicker textpattern help',
toolbar1: 'formatselect | bold underline italic strikethrough | backcolor forecolor | fontselect | fontsizeselect | alignleft aligncenter alignright alignjustify | table ',
toolbar2: 'numlist bullist | outdent indent | removeformat | subscript superscript | link unlink',
fontsize_formats: '7px 8px 9px 10px 11px 12px 13px 14px 15px 16px 17px 18px 19px 20px 21px 22px 23px 24px 25px 26px 27px 28px 29px 30px',
image_advtab: true
});
</script>
The problem is in the table plug-in, when I select cellspace and cellpadding from the editor it works, and seems save it correctly, but when I go in the view page of that element the table don't have that attributes. when I go in the developer tools in chrome I see:
th, td {
padding: 0
}
And if I disable that the table goes in the right dimension...
Anyone can tell me what is the problem??
If it looks correct in TinyMCE but not when rendered outside the editor its likely the CSS of your page is causing that change. This appears to be the case based on what you state about the th and td padding in the dev tools.
I'd like to convert this SVG to PDF with the size scaled up to x10 of it's current size without losing the quality of the picture. The PDF should also be in 300 PPI. How can I achieve kind of output?
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="248.1" height="350.7" viewBox="0 0 248.1 350.7" xml:space="preserve">
<desc>Created with Fabric.js 1.7.19</desc>
<defs>
</defs>
<g transform="translate(51.2 34.1) scale(0.1 0.1)">
<image xlink:href="./cat.jpg" x="-512" y="-341" style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" width="1024" height="682" preserveAspectRatio="none"></image>
</g>
</svg>
This SVG came from fabricjs toSVG() code. I can resize it using fabricjs, but I'd like to know is it possible to do this and how using ImageMagick.
ImageMagick is a programm suite aimed at raster images. What you have is a format that mixes vector and raster content both for input and output.
ImageMagick can handle that, but only through additional programs that need to be installed:
import from SVG with Inkscape or librsvg
export to PDF with ghostscript
You can cutout the middleman. Inkscape, while being mainly a SVG editor GUI, also has a commandline mode, for example for export tasks. You can scale the SVG by multiplying the height and width values on the root element with your scale - do not change the viewBox attribute:
<svg width="2481" height="3507" viewBox="0 0 248.1 350.7" ...>
Or, if you know the target size of the pages you want, you can set them. Even if aspect ratio does not fit, your content will sized-to-fit on the page. For example with a A4 page:
<svg width="210mm" height="297mm" viewBox="0 0 248.1 350.7" ...>
Then execute Inkscape:
inkscape --without-gui --export-pdf=out.pdf in.svg
Pictures are embeded as-is, so you do not loose resolution.
I used fontsquirrel to download webfonts but the letter spacing doubles on the iPhone. I tried enabling "remove kerning" in the fontsquirrel settings but that doesn't work.
#font-face {
font-family: 'fjalla_oneregular';
src: url('../../core/texts/fjallaone-regular-webfont.eot');
src: url('../../core/texts/fjallaone-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../../core/texts/fjallaone-regular-webfont.woff2') format('woff2'),
url('../../core/texts/fjallaone-regular-webfont.woff') format('woff'),
url('../../core/texts/fjallaone-regular-webfont.ttf') format('truetype'),
url('../../core/texts/fjallaone-regular-webfont.svg#fjalla_oneregular') format('svg');
font-weight: normal;
font-style: normal;
-webkit-font-smoothing: antialiased;
}
.post-header h1 {
font-family: "fjalla_oneregular", Impact, Helvetica Neue, Helvetica, sans-serif;
font-weight: 700;
text-transform: uppercase;
color: #191919;
letter-spacing: 0px;
}
Is there a workaround to make the spacing match between desktop browsers and mobile?
That can be a confusing and tough problem to find the solution for. Try moving the SVG URL line before the EOT URL line. It appears that Chrome utilises the .svg file in the #font-face kit, and doesn’t like being called last. Below is the standard call for #font-face using CSS:
#font-face {
font-family: 'chunk-webfont';
src: url('../../includes/fonts/chunk-webfont.eot');
src: url('../../includes/fonts/chunk-webfont.eot?#iefix') format('eot'),
url('../../includes/fonts/chunk-webfont.woff') format('woff'),
url('../../includes/fonts/chunk-webfont.ttf') format('truetype'),
url('../../includes/fonts/chunk-webfont.svg') format('svg');
font-weight: normal;
font-style: normal;
}
As can be seen in the example, the .svg file comes last in the list of called URLs. If we amend the code to target webkit browsers, then tell them to solely utilize the .svg file.
#font-face {
font-family: 'chunk-webfont';
src: url('../../includes/fonts/chunk-webfont.eot');
src: url('../../includes/fonts/chunk-webfont.eot?#iefix') format('eot'),
url('../../includes/fonts/chunk-webfont.woff') format('woff'),
url('../../includes/fonts/chunk-webfont.ttf') format('truetype'),
url('../../includes/fonts/chunk-webfont.svg') format('svg');
font-weight: normal;
font-style: normal;
}
#media screen and (-webkit-min-device-pixel-ratio:0) {
#font-face {font-family: ‘chunk-webfont’;
src: url(‘../../includes/fonts/chunk-webfont.svg’) format(‘svg’);
}
I was using a typeface and the same code from FontSquirrel and recently after the iOS 10 update a few of my sites were all broken with incorrect font spacing.
See Font Face Chrome Rendering for reference
(Big thanks to Sam Goddard for that post!)
I would like to combine 2 images, which are identical in width, but vary in height. They are identical on the bottom/top side, but it's unknown how much.
1) Identify identical parts
2) Combine the images so the identical parts match
Example:
Part 1: http://i.imgur.com/rZtAk2c.png
Part 2: http://i.imgur.com/CQaQbr8.png
1. Determine the image dimensions
Use identify to get width and height of each image:
identify \
http://i.imgur.com/rZtAk2c.png \
http://i.imgur.com/CQaQbr8.png
CQaQbr8.png PNG 701x974 720x994+10+0 8-bit sRGB 256c 33.9KB 0.000u 0:00.000
rZtAk2c.png PNG 701x723 720x773+10+46 8-bit sRGB 256c 25.6KB 0.000u 0:00.000
2. Interpret the results
The results from the above command are these:
Both images show 701 pixels wide rows.
One image shows 974 different rows.
The other image shows 723 different rows.
But both images use a different 'canvas' size.
The first image uses a 720x994 pixels canvas (offset of shown part is +10+0).
The second image uses a 720x773 pixels canvas (offset of shown part is +10+46).
3. Normalize the canvas to be identical with the shown pixels
We use the +repage image operator to normalize the canvas for both images:
convert CQaQbr8.png +repage img1.png
convert rZtAk2c.png +repage img2.png
4. Check both new images' dimensions again
identify img1.png img2.png
img1.png PNG 701x974 701x974+0+0 8-bit sRGB 256c 33.9KB 0.000u 0:00.000
img2.png PNG 701x723 701x723+0+0 8-bit sRGB 256c 25.5KB 0.000u 0:00.000
5. Learn, how to extract a single row from an image.
As an example, we extract row number 3 from img1.png (numbering starts with 0):
convert img1.png[701x1+0+3] +repage img1---row3.png
identify img---row3.png
img1---row3.png PNG 701x1 701x1+0+0 8-bit sRGB 256c 335B 0.000u 0:00.000
6. Learn, how to extract that same row in ImageMagick's 'txt' format:
convert img1.png[701x1+0+3] +repage img---row3.txt
If you are not familiar with the 'txt' format, here is an extract:
cat img---row3.txt
# ImageMagick pixel enumeration: 701,1,255,gray
0,0: (255,255,255) #FFFFFF gray(255)
1,0: (255,255,255) #FFFFFF gray(255)
2,0: (255,255,255) #FFFFFF gray(255)
3,0: (255,255,255) #FFFFFF gray(255)
4,0: (255,255,255) #FFFFFF gray(255)
5,0: (255,255,255) #FFFFFF gray(255)
6,0: (255,255,255) #FFFFFF gray(255)
7,0: (255,255,255) #FFFFFF gray(255)
8,0: (255,255,255) #FFFFFF gray(255)
9,0: (255,255,255) #FFFFFF gray(255)
[...skipping many lines...]
695,0: (255,255,255) #FFFFFF gray(255)
696,0: (255,255,255) #FFFFFF gray(255)
697,0: (255,255,255) #FFFFFF gray(255)
698,0: (255,255,255) #FFFFFF gray(255)
699,0: (255,255,255) #FFFFFF gray(255)
700,0: (255,255,255) #FFFFFF gray(255)
The 'txt' output file describes every pixel via a text line.
In each line the first column indicates the respective pixel's coordinates.
The second, third and fourth columns indicate the pixel's color in different ways (but they contain the same information each).
7. Convert each row into its 'txt' format and create its MD5 sum
This command also creates 'txt' output. But this time the 'target' file is given as txt:-. This means that the output is streamed to <stdout>.
for i in {0..973}; do \
convert img1.png[701x1+0+${i}] txt:- \
| md5sum > md5sum--img1--row${i}.md5 ; \
done
This command creates 974 different files containing the MD5 sum of the 'txt' representation for the respective rows.
We can also write all MD5 sums into a single file:
for i in {0..973}; do \
convert img1.png[701x1+0+${i}] txt:- \
| md5sum >> md5sum--img1--all-rows.md5 ; \
done
Now do the same thing for img2.png:
for i in {0..722}; do \
convert img2.png[701x1+0+${i}] txt:- \
| md5sum >> md5sum--img2--all-rows.md5 ; \
done
8. Use sdiff to determine which lines of the .md5 files match
We can use sdiff to compare the two .md5 files line by line and write the output to a log file. The nl -v 0 part of the following command automatically inserts the line number, starting with 0 into the result:
sdiff md5sum--img{1,2}--all-rows.md5 | nl -v 0 > md5sums.log
9. Check the md5sums.log for identical lines
cat md5sums.log
0 > 38c6cd70c39ffc853d1195a0da6474f8 -
1 > 85100351b390ace5a7caca11776666d5 -
2 > 66e2940dbb390e635eeba9a2944960dc -
3 > 8e93c1ed5c89aead8333f569cb768e4a -
4 > 8e93c1ed5c89aead8333f569cb768e4a -
[... skip many lines ...]
172 > f9fece874b60fa1af24516c4bcee7302 -
173 > edbe62592a3de60d18971dece07e3beb -
174 > 18a28776cc64ead860a99213644b0574 -
175 0d0753c587dc3c46078ac265895a3f6c - | 0d0753c587dc3c46078ac265895a3f6c -
176 5ecc2b5a61af4120151fed4cd2c3d305 - | 5ecc2b5a61af4120151fed4cd2c3d305 -
177 3f2857594fe410dc7fe42b4bef724a87 - | 3f2857594fe410dc7fe42b4bef724a87 -
178 2fade815d804b6af96550860602ec1ba - | 2fade815d804b6af96550860602ec1ba -
[... skip many lines ...]
719 127e6d52095db20f0bcb1fe6ff843da0 - | 127e6d52095db20f0bcb1fe6ff843da0 -
720 aef15dde4909e9c467f11a64198ba6d2 - | aef15dde4909e9c467f11a64198ba6d2 -
721 6320863dd7d747356f4b23fb7ba28a73 - | 6320863dd7d747356f4b23fb7ba28a73 -
722 2e32ceb7cc89d7bb038805e484dc7bc9 - | 2e32ceb7cc89d7bb038805e484dc7bc9 -
723 f9fece874b60fa1af24516c4bcee7302 - <
724 f9fece874b60fa1af24516c4bcee7302 - <
725 f9fece874b60fa1af24516c4bcee7302 - <
726 f9fece874b60fa1af24516c4bcee7302 - <
[... skip many lines ...]
1146 3e18a7db0aed8b6ac6a3467c6887b733 - <
1147 62866c8ef78cdcd88128b699794d93e6 - <
1148 7dbed48a0e083d03a6d731a6864d1172 - <
From this output we can conclude that rows 175 -- 722 in the sdiff-produced file all do match.
This means that there is a match in the following rows of the original images:
row 0 of img1.png matches row 175 of img2.png (begin of match).
img1.png has a total of 974 rows of pixels.
row 547 of img1.png matches row 722 of img2.png (end of match).
img2.png has a total of 723 rows of pixels.
(Remember, we used 0-based row numbering...)
10. Put it all together now
From above investigations we can conclude, that we need only the first 174 rows from img1.png and append the full img2.png below that in order to get the correct result:
convert img1.png[701x174+0+0] img2.png -append complete.png
NOTES:
There are many possible solutions (and methods to arrive there) to the problem posed by the OP. For example:
Instead of converting the rows to 'txt' format we could have used any other ImageMagick-supported format also (PNG, PPM, ...) and created the MD5 sums for comparison.
Instead of using -append to concatenate the two image parts, we could also have used -composite to superimpose them (with an appropriate offset, of course).
As #MarkSetchell says in his comment: instead of piping the 'pixel-rows' output to md5sum one could also use -format '%#' info:- to directly generate a hash value from the respective pixel-row. I had already forgotten about that option, because (years ago) I tried to use it for a similar purpose, and somehow it didn't work as I needed it. Which is why I became used to my 'piping to md5sum' approach...
Is it possible with nbconvert --> latex --> PDF to suppress section numberings?
Essentially I would like to keep the simple font size distinctions that the markdown header syntax (#, ##, etc.), and ipynb section headings provide (nbconvert --to latex appears to treat these same), and still use these to define section headings, but without the numberings. Then I also have the option of adding my own numbers manually.
I can cope with losing some aspects of general latex document structuring and functionality. Ideally though I would like to keep that information, and just suppress the numberings in the PDF.
Cheers.
You can simply use the stared version of the LaTeX heading tags (section*, subsection*).
To do so, you have to create a custom template (e.g. secnum.tplx) which could look like the following
for IPython 1.x:
((*- extends 'latex_article.tplx' -*))
((* block h1 -*))section*((* endblock h1 -*))
((* block h2 -*))subsection*((* endblock h2 -*))
((* block h3 -*))subsubsection*((* endblock h3 -*))
((* block h4 -*))paragraph*((* endblock h4 -*))
((* block h5 -*))subparagraph*((* endblock h5 -*))
for IPython 2.x:
((*- extends 'article.tplx' -*))
((* block h1 -*))\section*((* endblock h1 -*))
((* block h2 -*))\subsection*((* endblock h2 -*))
((* block h3 -*))\subsubsection*((* endblock h3 -*))
((* block h4 -*))\paragraph*((* endblock h4 -*))
((* block h5 -*))\subparagraph*((* endblock h5 -*))
for IPython 3.x:
As IPython 3.x removed the heading cell type these approaches are no longer applicable here.
((* extends 'article.tplx' *))
((* block commands *))
\setcounter{secnumdepth}{0} % Turns off numbering for sections
((( super() )))
((* endblock commands *))
Note that stared headings will not be present in the TOC.
To use these templates, call them during the conversion like
ipython nbconvert --to=latex --template=secnum.tplx file.ipynb