Can you please help me out with an issue? I am using umbraco v7.10.4 and want to receive an watermarked image from the Media gallery.
This is the code I am using in a partial view (put this together after googling a bit):
var mediaItem = Umbraco.TypedMedia(1117);
if (mediaItem != null)
{
var furtherOptions = "&watermark=MyTestWatermark&color=fff&fontsize=36&fontstyle=italic&fontopacity=80&dropshadow=true";
<div class="banner"><img src="@Url.GetCropUrl(mediaItem, null, null, "umbracoFile", null, null, null, null, false,false, false, furtherOptions)" alt="img"></div>
}
I found that only this overload of Url.GetCropUrl allows to receive the "furtherOptions" parameter that should contain instructions for the Image Processor.
I have checked the /config/imageProcessor config files (they are unaltered from the default installation) and seem to be configured properly.
The issue is that I am getting the image, but no watermark whatsoever.
Nothing in the logs to suggest any error.
Do you have any ideas? or any better way to accomplish this (for example would have liked to be able to get the image by the name in the gallery)?
That "enabled=true" did the trick. Never occurred to me (the documentation on this feature is pretty slim) that each processing plugin must be enabled. Now, if I take a closer look, I can see that there are some other plugins enabled :).
That is interesting. Now that I have enabled the watermark feature how can I protect the site from malicious requests as described in your link? Is there any thing to protect the request using a token (some parameter with some hashed value that can be double checked on the server) ?
And another question: since all the image parameters are in the query string for the source image url, one can simply get that url and obtain the image without the watermark parameter. Any ideas on how to prevent that?
Umbraco ImageProcessor Watermark
Hi Everyone!
Can you please help me out with an issue? I am using umbraco v7.10.4 and want to receive an watermarked image from the Media gallery.
This is the code I am using in a partial view (put this together after googling a bit):
I found that only this overload of Url.GetCropUrl allows to receive the "furtherOptions" parameter that should contain instructions for the Image Processor.
I have checked the /config/imageProcessor config files (they are unaltered from the default installation) and seem to be configured properly.
The issue is that I am getting the image, but no watermark whatsoever.
Nothing in the logs to suggest any error.
Do you have any ideas? or any better way to accomplish this (for example would have liked to be able to get the image by the name in the gallery)?
Thank you! Cosmin
Hi Cosminu,
Can you show the link that is generated for the image ?
And can you check your config if watermark is enabled. You can check this in /config/imageprocessor/processing.config
You will need to set
enabled="true"
on this lineDave
Hi Dave!
Many thanks!
That "enabled=true" did the trick. Never occurred to me (the documentation on this feature is pretty slim) that each processing plugin must be enabled. Now, if I take a closer look, I can see that there are some other plugins enabled :).
Thank you once again!
Cosmin
Yep,
Some plugins got disabled for security reasons in 7.5.0
Some more information can be found here : https://umbraco.com/blog/umbraco-750-beta2-released/
Dave
That is interesting. Now that I have enabled the watermark feature how can I protect the site from malicious requests as described in your link? Is there any thing to protect the request using a token (some parameter with some hashed value that can be double checked on the server) ?
And another question: since all the image parameters are in the query string for the source image url, one can simply get that url and obtain the image without the watermark parameter. Any ideas on how to prevent that?
Thank you!
Cosmin
Hi cosminu,
There is a link in the blogpost that shows you how you can validate requests coming in to image processor.
So you could validate if the watermark is allowed : https://gist.github.com/nul800sebastiaan/dcb2da9e664dbe17c95bac235e3f87db
Dave
is working on a reply...