From: Jonathan S. Katz <jkatz@postgresql.org>
To: Pg Docs <pgsql-docs@lists.postgresql.org>
Subject: Responsive images in pgweb docs
Date: Sun, 31 Mar 2019 10:23:46 -0400
Message-ID: <6d2442d1-84a2-36ef-e014-b6d1ece8a139@postgresql.org> (raw)
Hi,
First, many thanks on all the hard work for getting images into the
documentation, this is certainly a great new feature for ours users.
When testing the rendering of the images on the pgweb docs, I discovered
that they are not responsive (see attached) and in its current state,
basically makes any page that loads an image significantly more
challenging to read on mobile.
I've devised a solution to the problem, which will take work both on the
pgweb front as well as the SVG image generation.
The pgweb side is relatively simple: wherever we see ".figure" we can
tack on ".col-xl-8.col-lg-10.col-md-12" (Bootstrap grid codes) which
provides some readable images.
However, that in itself will not make the images responsive. It appears
that the width/height are at present hardcoded onto the SVG, for example
in doc/src/sgml/images/gin.svg you find:
<svg width="836pt" height="432pt" viewBox="0.00 0.00 836.00 432.00" ...
In order to make the SVG responsive, we can change the top line to be:
<svg viewBox="0.00 0.00 836.00 432.00" preserveAspectRatio="xMinYMin
meet" ...
and this fixes it. If/when the change is accepted, I can push the change
to the pgweb code that allows for the responsiveness.
I can fairly easy come up with a patch to do this for the current SVGs
(attached). I tested against the PDF build and it looks fine.
Based on the earlier discussions, I'm wondering how we would want to
proceed for future images, as I know the goal is to limit the amount of
manual editing once an image is generated.
Thanks,
Jonathan
From b4f94ee3b62d4eeec45cfa4fbba5375810d8ae59 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Sun, 31 Mar 2019 10:16:26 -0400
Subject: [PATCH] Modify SVGs to not have view boxes that can scale based on
viewing container.
This allows for responsive image viewing, particularly on the web.
---
doc/src/sgml/images/gin.svg | 3 +--
doc/src/sgml/images/pagelayout.svg | 8 ++++----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/doc/src/sgml/images/gin.svg b/doc/src/sgml/images/gin.svgindex eacb5c8c16..493f0ffa76 100644--- a/doc/src/sgml/images/gin.svg+++ b/doc/src/sgml/images/gin.svg@@ -4,8 +4,7 @@
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: gin Pages: 1 -->
-<svg width="836pt" height="432pt"- viewBox="0.00 0.00 836.00 432.00" xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink";+<svg viewBox="0.00 0.00 836.00 432.00" preserveAspectRatio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink";
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 428)">
<title>gin</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-428 832,-428 832,4 -4,4"/>
diff --git a/doc/src/sgml/images/pagelayout.svg b/doc/src/sgml/images/pagelayout.svgindex 6b819a553e..95711c541f 100644--- a/doc/src/sgml/images/pagelayout.svg+++ b/doc/src/sgml/images/pagelayout.svg@@ -1,8 +1,8 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
-<svg +<svg
xmlns='http://www.w3.org/2000/svg';
- width='610'- height='210'+ viewBox="0.00 0.00 610.00 210.00"+ preserveAspectRatio="xMinYMin meet"
shape-rendering='geometricPrecision'
version='1.0'>
<defs>
@@ -37,4 +37,4 @@
<text x='324' y='166' font-family='Courier' font-size='15' stroke='none' fill='#000000' ><![CDATA[Item]]></text>
<text x='509' y='166' font-family='Courier' font-size='15' stroke='none' fill='#000000' ><![CDATA[Special]]></text>
</g>
-</svg>
\ No newline at end of file
+</svg>
--
2.14.3 (Apple Git-98)
Attachments:
[text/plain] 0001-Modify-SVGs-to-not-have-view-boxes-that-can-scale-ba.patch (2.1K, ../6d2442d1-84a2-36ef-e014-b6d1ece8a139@postgresql.org/2-0001-Modify-SVGs-to-not-have-view-boxes-that-can-scale-ba.patch)
download | inline diff:
From b4f94ee3b62d4eeec45cfa4fbba5375810d8ae59 Mon Sep 17 00:00:00 2001
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
Date: Sun, 31 Mar 2019 10:16:26 -0400
Subject: [PATCH] Modify SVGs to not have view boxes that can scale based on
viewing container.
This allows for responsive image viewing, particularly on the web.
---
doc/src/sgml/images/gin.svg | 3 +--
doc/src/sgml/images/pagelayout.svg | 8 ++++----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/doc/src/sgml/images/gin.svg b/doc/src/sgml/images/gin.svgindex eacb5c8c16..493f0ffa76 100644--- a/doc/src/sgml/images/gin.svg+++ b/doc/src/sgml/images/gin.svg@@ -4,8 +4,7 @@
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: gin Pages: 1 -->
-<svg width="836pt" height="432pt"- viewBox="0.00 0.00 836.00 432.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">+<svg viewBox="0.00 0.00 836.00 432.00" preserveAspectRatio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 428)">
<title>gin</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-428 832,-428 832,4 -4,4"/>
diff --git a/doc/src/sgml/images/pagelayout.svg b/doc/src/sgml/images/pagelayout.svgindex 6b819a553e..95711c541f 100644--- a/doc/src/sgml/images/pagelayout.svg+++ b/doc/src/sgml/images/pagelayout.svg@@ -1,8 +1,8 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
-<svg +<svg
xmlns='http://www.w3.org/2000/svg'
- width='610'- height='210'+ viewBox="0.00 0.00 610.00 210.00"+ preserveAspectRatio="xMinYMin meet"
shape-rendering='geometricPrecision'
version='1.0'>
<defs>
@@ -37,4 +37,4 @@
<text x='324' y='166' font-family='Courier' font-size='15' stroke='none' fill='#000000' ><![CDATA[Item]]></text>
<text x='509' y='166' font-family='Courier' font-size='15' stroke='none' fill='#000000' ><![CDATA[Special]]></text>
</g>
-</svg>
\ No newline at end of file
+</svg>--
2.14.3 (Apple Git-98)
[image/jpeg] IMG_8936.jpg (68.9K, ../6d2442d1-84a2-36ef-e014-b6d1ece8a139@postgresql.org/3-IMG_8936.jpg)
download | view image
[application/pgp-signature] signature.asc (832B, ../6d2442d1-84a2-36ef-e014-b6d1ece8a139@postgresql.org/4-signature.asc)
download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: jkatz@postgresql.org, pgsql-docs@lists.postgresql.org
Subject: Re: Responsive images in pgweb docs
In-Reply-To: <6d2442d1-84a2-36ef-e014-b6d1ece8a139@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox