Hello,
I solved this by adding this in GetPictureUrl(..)
var strcall = GetCallingMethod("GetPictureUrl");
String specialFThumbFileParameter = null;
if (strcall == "FoxNetSoft.Plugin.Feed.Manager.Services.FeedPictureService.GetFeedPictureUrl")
specialFThumbFileParameter = "Feed";
So I can call an overridden adjusted GetPictureUrl(..) with following additional code to generete specific thumbs marked as i.e. "canvas-resised":
if(!String.IsNullOrEmpty(specialThumbFilenameParameter))
thumbFileName = !String.IsNullOrEmpty(seoFileName)
? string.Format("{0}_{1}_{2}_{4}.{3}", picture.Id.ToString("0000000"), seoFileName, targetSize, lastPart, specialThumbFilenameParameter)
: string.Format("{0}_{1}_{3}.{2}", picture.Id.ToString("0000000"), targetSize, lastPart, specialThumbFilenameParameter);
To actually resize canvas, some lines below, I adjusted Nop-code like that:
using (var destStream = new MemoryStream())
{
var newSize = CalculateDimensions(b.Size, targetSize);
if (!String.IsNullOrEmpty(specialThumbFilenameParameter)) // checking if pic is for google feed, then resize canvas for width = height
if (newSize.Height < targetSize)
newSize.Height = targetSize;
else if (newSize.Width < targetSize)
newSize.Width = targetSize;
ImageBuilder.Current.Build(b, destStream, new ResizeSettings
{
Width = newSize.Width,
Height = newSize.Height,
Scale = ScaleMode.Both,
Quality = _mediaSettings.DefaultImageQuality
});
pictureBinaryResized = destStream.ToArray();
b.Dispose();
}
Thats works for me..BUT would be more efficient to be able to drop "GetCallerMethod(..)" to know when to get/use canvas-changed thumbs or not.. Best way was , I guess, to implement special-Thumb-generation in directly in Feedmanager by an option. But this is of course your choice :-) Dont know for sure, but there has to be others facing same challenge with google-Pics minimum size of BOTH x and y to 100px.