Skip to main content

How can I force a specific image to feature when sharing my links on Facebook?

Comments

3 comments

  • Mirha Masala

    I have the following code in Rails. Unfortunately, the width attribute doesn't seem to be taking.

    ```
    <% content_for :meta_image, cl_image_path(@recipe.photo.key, width: 1200, quality: "auto") if @recipe.photo.attached? %>

    ```

    What am I missing?

    0
  • Aleksandar Kostadinov

    Hi Mirha,

    The width parameter is not being reflected in the URL since width/height relies on another parameter being present - "crop" - which controls what type of cropping to apply. You could try to set - crop: "scale" - in your cl_image_path and that will use the "scale" mode and the width and crop mode parameters would be added to the URL.

    Please see the below section in the documentation that provides more details on the different crop modes available so that you can find the best one for your requirements (as it may not be "scale" which was just an example) -

    https://cloudinary.com/documentation/image_transformation_reference#crop_parameter

    0
  • Mirha Masala

    Oh, got it! That makes sense. Thank you. 🙂

    0

Please sign in to leave a comment.