<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Пан Кіт</title>
    <description>The latest articles on DEV Community by Пан Кіт (@lilpunkit).</description>
    <link>https://dev.to/lilpunkit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1264394%2F63ba6ec8-af4f-407b-aa04-559b33a59244.png</url>
      <title>DEV Community: Пан Кіт</title>
      <link>https://dev.to/lilpunkit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lilpunkit"/>
    <language>en</language>
    <item>
      <title>OG Image generator based on SVG template</title>
      <dc:creator>Пан Кіт</dc:creator>
      <pubDate>Wed, 28 Feb 2024 08:35:27 +0000</pubDate>
      <link>https://dev.to/lilpunkit/og-image-generator-based-on-svg-template-355d</link>
      <guid>https://dev.to/lilpunkit/og-image-generator-based-on-svg-template-355d</guid>
      <description>&lt;p&gt;I like the idea of generating OpenGraph images based on some template. SVG structure looks customizable to me, so I tried to use .svg as an OG image and failed. OpenGrapgh does not support this format.&lt;/p&gt;

&lt;p&gt;I have Rails app deployed to Heroku. I found a great idea of how to automate OG image creation &lt;a href="https://tseivo.com/b/memecode/t/qg2kxgeqxr"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What we have to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an SVG template (use ERB to support variables);&lt;/li&gt;
&lt;li&gt;Add mini_magic or similar lib for SVG to JPG conversion;&lt;/li&gt;
&lt;li&gt;Create a rake task for generating JPG from SVG;&lt;/li&gt;
&lt;li&gt;Add rake task to Heroku scheduler;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Created rake task will generate and attach JPG to model (will be uploaded to AWS); Rake task should find records without attached OG image. Sometimes you need to regenerate OG image, so it will be nice to have record-marking functionality.&lt;/p&gt;

&lt;p&gt;This flow allows us to have an SVG template for the OG image, and also will separate CPU consumption (scheduler will use separate Dyno instance).&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>svg</category>
      <category>opengraph</category>
    </item>
  </channel>
</rss>
