<?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: Victor Moni</title>
    <description>The latest articles on DEV Community by Victor Moni (@victormoni).</description>
    <link>https://dev.to/victormoni</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3268790%2F4033fd3f-15c8-4c18-862a-03fb619ef882.png</url>
      <title>DEV Community: Victor Moni</title>
      <link>https://dev.to/victormoni</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/victormoni"/>
    <language>en</language>
    <item>
      <title>State and Events in Dapr: Following an Order from Start to Finish</title>
      <dc:creator>Victor Moni</dc:creator>
      <pubDate>Thu, 05 Nov 2026 21:48:48 +0000</pubDate>
      <link>https://dev.to/victormoni/state-and-events-in-dapr-following-an-order-from-start-to-finish-4mfh</link>
      <guid>https://dev.to/victormoni/state-and-events-in-dapr-following-an-order-from-start-to-finish-4mfh</guid>
      <description>&lt;p&gt;Imagine a small online store. When a customer confirms a purchase, the application needs to save the order and notify other services. A notification service sends a confirmation, while a shipping service begins preparing the delivery.&lt;/p&gt;

&lt;p&gt;This scenario illustrates two distinct responsibilities: storing information and communicating that something happened. Dapr provides APIs for both through its state management and publish/subscribe building blocks.&lt;/p&gt;

&lt;p&gt;This article explores a conceptual design rather than a tested implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Saving the Order with State Management
&lt;/h2&gt;

&lt;p&gt;Dapr’s state management API lets applications save and retrieve key/value pairs using a configured state store component. In our store, a key such as &lt;code&gt;order-123&lt;/code&gt; could identify an order’s data.&lt;/p&gt;

&lt;p&gt;The application calls the Dapr API, while the component configuration specifies the underlying storage system. This separation can reduce application code changes when switching infrastructure. However, storage systems do not all support the same capabilities or guarantees.&lt;/p&gt;

&lt;p&gt;Concurrency matters, too. If two processes update the same order, how should the application handle competing changes? Dapr supports optimistic concurrency control through ETags, but developers still need to select the appropriate behavior and handle conflicts.&lt;/p&gt;

&lt;p&gt;A shared API therefore does not remove the need to understand the selected component. Before changing state stores, check their supported features and consistency guarantees.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.dapr.io/developing-applications/building-blocks/state-management/state-management-overview/" rel="noopener noreferrer"&gt;Read the Dapr state management overview&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Notifying Other Services with Pub/Sub
&lt;/h2&gt;

&lt;p&gt;After saving the order, the application could publish an event to a topic such as &lt;code&gt;orders-created&lt;/code&gt;. Interested services subscribe to that topic and process its messages.&lt;/p&gt;

&lt;p&gt;Dapr connects to the messaging infrastructure through a pub/sub component. The application uses the Dapr API, while the component configuration supplies the broker-specific connection details.&lt;/p&gt;

&lt;p&gt;In our example, the notification and shipping services can each respond to the same event. Each consumer must define what successful processing means and what to do when processing fails.&lt;/p&gt;

&lt;p&gt;Dapr pub/sub provides at-least-once delivery semantics, so consumers must account for messages arriving more than once. For a notification service, processing the same event twice could mean sending duplicate purchase confirmations.&lt;/p&gt;

&lt;p&gt;One possible approach is to assign each event an identifier and track which events have already been processed. The design must also consider failures between performing an action and recording its completion: simply checking an identifier does not make every operation safe to repeat.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-overview/" rel="noopener noreferrer"&gt;Read the Dapr pub/sub overview&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting State and Events
&lt;/h2&gt;

&lt;p&gt;The proposed flow raises an important question: what happens if saving the order succeeds, but publishing the event fails?&lt;/p&gt;

&lt;p&gt;The order would exist, yet other services might never learn about it. Calling two APIs in sequence does not automatically make the operations atomic.&lt;/p&gt;

&lt;p&gt;Dapr supports a transactional outbox capability for coordinating state changes and event publication with a compatible transactional state store. Whether it fits a particular application depends on the selected components and configuration.&lt;/p&gt;

&lt;p&gt;Even in a small application, this failure case deserves an explicit design decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploring the Failure Cases
&lt;/h2&gt;

&lt;p&gt;To turn this scenario into a practical learning exercise, I would start with three experiments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deliver the same event twice and check whether the consumer produces duplicate effects.&lt;/li&gt;
&lt;li&gt;Stop a consumer, publish an event, and observe what happens after the consumer restarts.&lt;/li&gt;
&lt;li&gt;Simulate a failure between saving the order and publishing its event, then examine how the application detects and recovers from it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are proposed exercises, not test results reported in this article.&lt;/p&gt;

&lt;p&gt;Following one order through persistence, publication, and consumption makes each building block’s responsibility easier to understand. It also provides a manageable starting point for learning how a distributed application behaves when part of its workflow fails.&lt;/p&gt;

</description>
      <category>api</category>
      <category>architecture</category>
      <category>backend</category>
      <category>microservices</category>
    </item>
    <item>
      <title>Building SP Layers: Exploring São Paulo Through Photography and Cloudinary</title>
      <dc:creator>Victor Moni</dc:creator>
      <pubDate>Wed, 04 Nov 2026 23:50:57 +0000</pubDate>
      <link>https://dev.to/victormoni/building-sp-layers-exploring-sao-paulo-through-photography-and-cloudinary-19ik</link>
      <guid>https://dev.to/victormoni/building-sp-layers-exploring-sao-paulo-through-photography-and-cloudinary-19ik</guid>
      <description>&lt;p&gt;São Paulo has many rhythms: busy avenues, street art, food markets, historic buildings, and green spaces tucked between the concrete.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;SP Layers — São Paulo in Layers&lt;/strong&gt; as an interactive way to explore those different sides of the city.&lt;/p&gt;

&lt;p&gt;Created for the &lt;strong&gt;Cloudinary November Mini-Hack: Celebrate Where You're From&lt;/strong&gt;, the project combines photo stories, small discoveries, and personalized postcards.&lt;/p&gt;

&lt;p&gt;🌎 &lt;strong&gt;&lt;a href="https://sp-layers.vercel.app/" rel="noopener noreferrer"&gt;Explore the live app&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
💻 &lt;strong&gt;&lt;a href="https://github.com/VictorMoni/sao-paulo-in-layers" rel="noopener noreferrer"&gt;View the source on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqtgrqcxwm9n7hd9v5zkk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqtgrqcxwm9n7hd9v5zkk.jpg" alt="SP Layers homepage with the São Paulo introduction and a photograph of Liberdade" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Exploring the city through its layers
&lt;/h2&gt;

&lt;p&gt;The experience brings together &lt;strong&gt;20 photo stories&lt;/strong&gt; across four categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Flavors:&lt;/strong&gt; food and the encounters around it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Street Art:&lt;/strong&gt; color and expression in public spaces.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Breathing Spaces:&lt;/strong&gt; places to slow down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;City &amp;amp; Memory:&lt;/strong&gt; architecture and urban history.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Visitors can open stories, choose three places, reorder their selection, and open an outing in Google Maps for walking, driving, or cycling.&lt;/p&gt;

&lt;p&gt;The app supports &lt;strong&gt;Brazilian Portuguese, English, and Spanish&lt;/strong&gt;, along with light and dark themes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu9etidoe6hox2xjoaf7r.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu9etidoe6hox2xjoaf7r.jpg" alt="SP Layers gallery showing category filters and photo stories about São Paulo" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Where Cloudinary fits in
&lt;/h2&gt;

&lt;p&gt;Photography is central to the experience. The same image needs to work in a gallery, a portrait comparison, and a postcard.&lt;/p&gt;

&lt;p&gt;I used &lt;strong&gt;Cloudinary’s URL-based transformations&lt;/strong&gt; to prepare different versions of each photograph.&lt;/p&gt;

&lt;p&gt;For the newer images, the gallery recipe looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;f_jpg,q_auto,c_fill,g_auto,w_720,h_518
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This produces a 720 × 518 JPEG crop with automatic quality and gravity.&lt;/p&gt;

&lt;p&gt;The treated portrait uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;f_jpg,q_auto,c_fill,g_auto,w_720,h_960/e_saturation:25/e_tint:12:df9a65
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a taller crop, increases saturation, and applies a warm tint.&lt;/p&gt;

&lt;p&gt;The app includes a before-and-after comparison so visitors can see how cropping and color treatment change the presentation. The reference image is also resized and compressed; it is a baseline without the additional color treatment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fra8gaiqsj7m1d0ldp2nd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fra8gaiqsj7m1d0ldp2nd.jpg" alt="Before-and-after comparison of Cloudinary cropping and warm color treatment" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the actual recipes and preparation details in the &lt;a href="https://github.com/VictorMoni/sao-paulo-in-layers/blob/master/CLOUDINARY.md" rel="noopener noreferrer"&gt;Cloudinary integration documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparing media separately from visits
&lt;/h2&gt;

&lt;p&gt;One architectural decision was to separate image preparation from the browsing experience.&lt;/p&gt;

&lt;p&gt;The workflow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Upload the photographs to Cloudinary.&lt;/li&gt;
&lt;li&gt;Generate the required transformations.&lt;/li&gt;
&lt;li&gt;Download and validate the prepared files.&lt;/li&gt;
&lt;li&gt;Publish those files with the static app.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The collection contains &lt;strong&gt;61 prepared media files&lt;/strong&gt;: three versions of each of the 20 photographs, plus the cover image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visits do not make Cloudinary requests.&lt;/strong&gt; Browsing, comparisons, quizzes, and postcard generation use the bundled assets. Preparing or updating those assets still consumes Cloudinary quota.&lt;/p&gt;

&lt;p&gt;This approach suits a curated collection with a known set of image variants. Adding new photographs requires an explicit preparation step.&lt;/p&gt;

&lt;p&gt;For traceability, the project includes a &lt;a href="https://github.com/VictorMoni/sao-paulo-in-layers/blob/master/dist/media/provenance.json" rel="noopener noreferrer"&gt;provenance manifest&lt;/a&gt; with transformation URLs, MIME types, file sizes, and SHA-256 hashes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turning exploration into a postcard
&lt;/h2&gt;

&lt;p&gt;Visitors can select three photos, add a personal message, and export a postcard as a PNG.&lt;/p&gt;

&lt;p&gt;The postcard is composed &lt;strong&gt;locally in the browser using Canvas&lt;/strong&gt;. On supported devices, visitors can share the file through native sharing; downloading provides a fallback.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd598pbjrhef2v58mertr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fd598pbjrhef2v58mertr.jpg" alt="Personalized São Paulo postcard featuring Liberdade, street art, and Ibirapuera, with photo credits" width="800" height="1067"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Photo attribution travels with the exported postcards, and the original sources and licenses remain available in the project.&lt;/p&gt;

&lt;p&gt;There is also a discovery mechanic: each story includes an observation question. Answering &lt;strong&gt;eight questions correctly&lt;/strong&gt; unlocks a special postcard featuring all 20 photographs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping the implementation small
&lt;/h2&gt;

&lt;p&gt;SP Layers uses &lt;strong&gt;HTML, CSS, and vanilla JavaScript&lt;/strong&gt;, with no package dependencies or build step. Vercel serves the static &lt;code&gt;dist/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;The implementation also includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lazy loading for comparison images.&lt;/li&gt;
&lt;li&gt;Reserved image dimensions to reduce layout shifts.&lt;/li&gt;
&lt;li&gt;Keyboard navigation support and a skip link.&lt;/li&gt;
&lt;li&gt;Reduced-motion support.&lt;/li&gt;
&lt;li&gt;Browser storage for preferences and discovery progress.&lt;/li&gt;
&lt;li&gt;An optional map embed that loads after an explicit click.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No account is required. Personal postcard messages are not saved or included in shared selection links.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this project brings together
&lt;/h2&gt;

&lt;p&gt;SP Layers connects image processing with something visitors can explore and take away.&lt;/p&gt;

&lt;p&gt;Cloudinary prepares the visual variations, the static app presents the stories, and Canvas turns a visitor’s selection into a personal postcard.&lt;/p&gt;

&lt;p&gt;The project is also a chance to present São Paulo through smaller details: a meal, a mural, a park, or a building that makes someone stop and look.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://sp-layers.vercel.app/" rel="noopener noreferrer"&gt;Try SP Layers&lt;/a&gt;&lt;/strong&gt; and let me know: which three places would you put on your São Paulo postcard?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Photography belongs to the credited authors. Sources and licenses are available in the app and in the &lt;a href="https://github.com/VictorMoni/sao-paulo-in-layers/blob/master/dist/images/CREDITS.md" rel="noopener noreferrer"&gt;photo credits&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cloudinary</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Making Image Delivery Visible with Next.js and Cloudinary</title>
      <dc:creator>Victor Moni</dc:creator>
      <pubDate>Tue, 27 Oct 2026 18:45:10 +0000</pubDate>
      <link>https://dev.to/victormoni/making-image-delivery-visible-with-nextjs-and-cloudinary-2nml</link>
      <guid>https://dev.to/victormoni/making-image-delivery-visible-with-nextjs-and-cloudinary-2nml</guid>
      <description>&lt;p&gt;After completing &lt;strong&gt;Cloud to Crowd: Media IQ for Developers with Next.js&lt;/strong&gt;, I wanted a practical way to explore image delivery. With Codex assistance, I built &lt;strong&gt;Media Lab&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://media-lab-cloudinary.vercel.app/" rel="noopener noreferrer"&gt;Try the live demo&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/VictorMoni/media-lab-cloudinary" rel="noopener noreferrer"&gt;Explore the source code&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The same image can appear in a card, a gallery, or a portrait layout. Delivering the original file in every context deserves a closer look: the dimensions and crop each interface needs can be different.&lt;/p&gt;

&lt;p&gt;Media Lab explores this problem through a small Next.js learning project built with Codex assistance. Its purpose is to make image delivery decisions visible by letting you switch between an original image URL and a Cloudinary transformation URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnvv0obycp9hn633w9sgi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnvv0obycp9hn633w9sgi.png" alt="Media Lab on Vercel showing the portrait crop controls and a transformed flower image" width="498" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The actual deployed application, with Portrait selected.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A small, observable experiment
&lt;/h2&gt;

&lt;p&gt;The lab includes a gallery of four public Cloudinary sample images. Select an image, switch between landscape, square, and portrait crops, choose a delivery width, and inspect the resulting URL.&lt;/p&gt;

&lt;p&gt;A separate form lets you try a public image from another Cloudinary cloud by entering a cloud name and Public ID. It does not upload files or require an API secret. The asset must be publicly accessible and allow the requested transformations.&lt;/p&gt;

&lt;p&gt;The project is a learning experiment rather than a production storefront or client engagement.&lt;/p&gt;

&lt;h2&gt;
  
  
  The transformation is in the URL
&lt;/h2&gt;

&lt;p&gt;A landscape variant with a delivery width of 640 pixels uses this structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://res.cloudinary.com/demo/image/upload/c_fill,g_auto,w_640,h_427/q_auto/f_auto/sample
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each part represents a delivery decision:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;c_fill&lt;/code&gt; fills the requested dimensions, cropping when necessary.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;g_auto&lt;/code&gt; uses automatic gravity to guide the crop.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;w_640,h_427&lt;/code&gt; defines the dimensions of the variant.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;q_auto&lt;/code&gt; adjusts quality automatically.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;f_auto&lt;/code&gt; negotiates an appropriate format based on the requesting browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quality and format use separate URL components, as described in the &lt;a href="https://cloudinary.com/documentation/image_optimization" rel="noopener noreferrer"&gt;Cloudinary image optimization documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In Original mode, the URL includes none of these transformations. CSS still controls its displayed size, so the space an image occupies on the page should not be confused with the dimensions of the delivered file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdemo%2Fimage%2Fupload%2Fc_fill%2Cg_auto%2Cw_640%2Ch_427%2Fq_auto%2Ff_auto%2Fsample" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdemo%2Fimage%2Fupload%2Fc_fill%2Cg_auto%2Cw_640%2Ch_427%2Fq_auto%2Ff_auto%2Fsample" alt="Cloudinary flower sample delivered as a 640 by 427 pixel landscape crop" width="640" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A landscape variant of the same sample asset. Image source: Cloudinary demo cloud.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Centralizing delivery decisions
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;lib/cloudinary.mjs&lt;/code&gt; module builds image URLs and limits delivery widths to five options: 320, 480, 640, 960, and 1280 pixels. This avoids generating an unlimited number of variants for every small interface adjustment.&lt;/p&gt;

&lt;p&gt;The function also encodes Public ID segments while preserving folder separators and validates the cloud name before assembling a URL.&lt;/p&gt;

&lt;p&gt;Here is an example from the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;imageUrl&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;cloud&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;demo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;publicId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sample&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;640&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;portrait&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This requests a 640 × 800 pixel variant with automatic crop positioning, quality, and format selection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Responsive delivery and comparison serve different purposes
&lt;/h2&gt;

&lt;p&gt;The comparison panel requests a fixed width. This makes it possible to inspect a particular variant and see how each setting changes the URL.&lt;/p&gt;

&lt;p&gt;The gallery cards use &lt;code&gt;srcSet&lt;/code&gt; and &lt;code&gt;sizes&lt;/code&gt; instead. The browser receives several width candidates and selects one based on the available display space and pixel density.&lt;/p&gt;

&lt;p&gt;Images are delivered directly from Cloudinary through &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; elements, without an additional Next.js image optimization layer. Alternative text, lazy loading in the gallery, and image error messages complete the basic experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdemo%2Fimage%2Fupload%2Fc_fill%2Cg_auto%2Cw_640%2Ch_640%2Fq_auto%2Ff_auto%2Fcld-sample-2" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdemo%2Fimage%2Fupload%2Fc_fill%2Cg_auto%2Cw_640%2Ch_640%2Fq_auto%2Ff_auto%2Fcld-sample-2" alt="Mountain sample delivered as a square crop" width="640" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A square variant of another gallery asset. Image source: Cloudinary demo cloud.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What was checked
&lt;/h2&gt;

&lt;p&gt;During assisted development, Codex ran five automated tests covering URL generation and completed a production build successfully. Browser checks confirmed that the four sample images loaded and that switching to a portrait crop or the original version updated the URL and displayed dimension information.&lt;/p&gt;

&lt;p&gt;These checks cover parts of the implementation. They do not establish a performance improvement in a production application or prove that every crop is appropriate on every device.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measuring the next step
&lt;/h2&gt;

&lt;p&gt;The lab does not display estimated savings percentages. To report quantitative results, open the browser Network tab, disable caching, and record the transferred size and actual response format for each variant.&lt;/p&gt;

&lt;p&gt;Record the image dimensions too. Comparing a large original with a small cropped variant measures the combined effects of resizing, cropping, and optimization. Attributing the entire difference to compression would be misleading.&lt;/p&gt;

&lt;p&gt;Response times need similar care. Network conditions, caching, and the first generation of a transformation can affect a measurement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making image delivery decisions visible
&lt;/h2&gt;

&lt;p&gt;Working with media involves decisions about interface design, dimensions, cropping, and delivery. This example brings those decisions into a small interactive page, with URLs that can be inspected and opened separately.&lt;/p&gt;

&lt;p&gt;The next step is to try original assets, evaluate the crops, and record reproducible measurements. That provides a foundation for a more personal account of the choices made and the results observed while using the project.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://cloudinary.com/documentation/image_transformations" rel="noopener noreferrer"&gt;Cloudinary image transformations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloudinary.com/documentation/image_optimization" rel="noopener noreferrer"&gt;Cloudinary image optimization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/app/getting-started/installation" rel="noopener noreferrer"&gt;Next.js installation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://media-lab-cloudinary.vercel.app/" rel="noopener noreferrer"&gt;Open Media Lab&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/VictorMoni/media-lab-cloudinary" rel="noopener noreferrer"&gt;View the GitHub repository&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;By Victor Moni. Project and article developed with Codex assistance.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cloudinary</category>
      <category>nextjs</category>
      <category>webdev</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
