I want to show watermarked PDF file to end user on .erb view file on my application. For testing purpose firstly i tried to do this with jpeg image. My resources are;
This code is works but not yet watermarked.
<%= image_tag @image.variant(resize_to_limit: [800, 800], colourspace: "b-w").processed if @image.variable? %>
This code is not working. Error is VipsForeignLoad: file "http://localhost:3000/assets/placeholder-d1fde905b3fe89204148520108a99695bec9458f400d001b08626860983d5377.png" does not exist
<%= image_tag @image.variant(resize_to_limit: [800, 800], colourspace: "b-w", composite: [asset_url("placeholder.png"), "south-east"] ).processed if @image.variable? %>
Also i tried another approach which is not working too. Error is overlay must be a Vips::Image, String, Pathname, or respond to #path
<% water = ImageProcessing::Vips.Image.new %>
<% water.text("TEST KEYWORD")%>
<%= image_tag @image.variant(resize_to_limit: [800, 800], colourspace: "b-w", composite: [water, "south-east"] ).processed if @image.variable? %>
This is not working too. Error is like no _dump_data is defined for class FFI::Pointer
<%= image_tag @image.variant(resize_to_limit: [800, 800], colourspace: "b-w", composite: [overlay: Vips::Image.text("asdfasdf")] ).processed if @image.variable? %>