<?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>Forem: Dali</title>
    <description>The latest articles on Forem by Dali (@dalisys).</description>
    <link>https://forem.com/dalisys</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%2F2056698%2F8657258f-5ea8-4f79-85af-49a75565d874.jpeg</url>
      <title>Forem: Dali</title>
      <link>https://forem.com/dalisys</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/dalisys"/>
    <language>en</language>
    <item>
      <title>How to use Unsplash Images in your code</title>
      <dc:creator>Dali</dc:creator>
      <pubDate>Wed, 11 Sep 2024 08:26:56 +0000</pubDate>
      <link>https://forem.com/dalisys/how-to-use-unsplash-images-in-your-code-4me8</link>
      <guid>https://forem.com/dalisys/how-to-use-unsplash-images-in-your-code-4me8</guid>
      <description>&lt;p&gt;As a developer working on a new SaaS project, I needed to link some Unsplash images directly through their URLs. &lt;br&gt;
Initially, I came across an article (&lt;a href="https://dev.to/alexanie_/how-to-link-unsplash-images-in-html-and-css-5dd5"&gt;link&lt;/a&gt;) recommending the use of the &lt;code&gt;https://source.unsplash.com/&lt;/code&gt; API. However, this method no longer works, and simply copying the link from the URL field didn't provide the direct image URL needed for embedding.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://unsplash.com/photos/a-digital-illustration-of-the-letter-k-CnbzJXw5Hx4" rel="noopener noreferrer"&gt;https://unsplash.com/photos/a-digital-illustration-of-the-letter-k-CnbzJXw5Hx4&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm7nbgivm8tf6xzek4l38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm7nbgivm8tf6xzek4l38.png" alt="Unsplash Image link from the URL field"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Unsplash Image URLs
&lt;/h2&gt;

&lt;p&gt;The next option I tried was copying the image URL by right-clicking on it. However, this URL was filled with unnecessary parameters that I didn't need, requiring manual removal every time. For example:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight perl"&gt;&lt;code&gt;

&lt;span class="nv"&gt;https:&lt;/span&gt;&lt;span class="sr"&gt;//imag&lt;/span&gt;&lt;span class="nv"&gt;es&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;unsplash&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;photo&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1725610588086&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;b9e38da987f7&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;&lt;span class="sx"&gt;q=80&amp;amp;w=&lt;/span&gt;&lt;span class="mi"&gt;3500&lt;/span&gt;&lt;span class="nv"&gt;&amp;amp;auto&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="nv"&gt;&amp;amp;fit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;crop&amp;amp;ixlib&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;rb&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;4.0.3&lt;/span&gt;&lt;span class="nv"&gt;&amp;amp;ixid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="nv"&gt;D&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="nv"&gt;D&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;As a lazy developer who values efficiency, I found this process frustrating. I didn't want to manually clean up URLs every time I wanted to use an image.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Lightbulb Moment: Building my first Chrome Extension
&lt;/h2&gt;

&lt;p&gt;So, after wasting way too much time doing this manually, I did what any lazy developer with an aversion to repetitive tasks would do—I built a Chrome extension. Introducing "&lt;a href="https://chromewebstore.google.com/detail/copysplash-unsplash-image/nphognmkdpdfenhobfmedbpdahegdklm" rel="noopener noreferrer"&gt;CopySplash&lt;/a&gt;", the Chrome extension you never knew you needed but now can't live without!&lt;/p&gt;

&lt;p&gt;And the best part? It’s an open-source project! (&lt;a href="https://github.com/dalisys/copy-splash" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;) Feel free to dive into the code, contribute, suggest features, or even just tell me how much you love it or not😅. Compliments are always appreciated.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Does "CopySplash" Do?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Provides a convenient "Copy Link" button overlay on Unsplash images, allowing users to quickly copy the image URL to their clipboard with a single click.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frfvewswlux3pn7jqyn60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frfvewswlux3pn7jqyn60.png" alt="Copy link Button added by CopySplash"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set custom parameters to adjust the size, quality, cropping, and more, tailored to your specific needs and save them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8vw8co71mpqxdlplmme.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8vw8co71mpqxdlplmme.png" alt="Form to set custom settings to the Unsplash image added by CopySplash"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  But Wait… What’s the Deal with Unsplash and Imgix?
&lt;/h2&gt;

&lt;p&gt;Unsplash uses the Imgix rendering API (&lt;a href="https://docs.imgix.com/apis/rendering/overview" rel="noopener noreferrer"&gt;link&lt;/a&gt;), a powerful image processing service that dynamically resizes, crops, and optimizes images for web delivery. Every image URL from Unsplash is processed through Imgix, which is why the URLs are often filled with parameters.&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="https://docs.imgix.com/apis/rendering/overview" rel="noopener noreferrer"&gt;rendering API documentation&lt;/a&gt; to set your custom settings that will be integrated in the copied URL&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: No More Unsplash URL Drama!
&lt;/h2&gt;

&lt;p&gt;If you’re a developer who frequently uses Unsplash images, "CopySplash" can save you a lot of time and effort. Give it a try, and Whether you have an idea for a new feature, want to improve the code, or help with documentation, your input is welcome!&lt;/p&gt;

&lt;p&gt;Links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://chromewebstore.google.com/detail/copysplash-unsplash-image/nphognmkdpdfenhobfmedbpdahegdklm" rel="noopener noreferrer"&gt;CopySplash Extension&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/dalisys/copy-splash" rel="noopener noreferrer"&gt;CopySplash Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.imgix.com/apis/rendering/overview" rel="noopener noreferrer"&gt;Imgix&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://unsplash.com/" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>unsplash</category>
      <category>javascript</category>
      <category>design</category>
    </item>
  </channel>
</rss>
