(80040000) Parameter is not valid. Unable to save Component (tcm:0-0-0).
System.Drawing.Image.FromStream(Stream,Boolean,Boolean) System.Drawing.Image.FromStream(Stream) Tridion.EventSystem.InternetEventSystemNemespace.ABCEventSystem.OnComponentSavePre(Component,SaveEventArgs,EventPhases) System.RuntimeMethodHandle.InvokeMethod(Object,Object[],Signature,Boolean) System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object,Object[],Object[]) System.Delegate.DynamicInvokeImpl(Object[]) Tridion.ContentManager.Extensibility.EventSubscription.DeliverEvent(IEnumerable
1,TcmEventArgs,EventPhases) Tridion.ContentManager.Extensibility.EventSystem.DeliverEvent(IEnumerable
1,TcmEventArgs,EventDeliveryPhase) Tridion.ContentManager.Extensibility.EventSystem.DeliverEvent(IdentifiableObject,TcmEventArgs,EventDeliveryPhase) Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs) Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean) Tridion.ContentManager.ContentManagement.VersionedItem.Save() Tridion.ContentManager.BLFacade.ContentManagement.VersionedItemFacade.CreateAndCheckIn(UserContext,String,Boolean) XMLState.Save Component.Save
I would like to use SVG images on my website. However uploading this type into the multimedia schema "multimedia_picture" fails. I get the error "Parameter is not valid".
I have added 'SVG Type' to my multimedia schema. Is there anything else I am missing?
Update: Event System code added
// only for multimedia components
if (comp.ComponentType.ToString().Equals("Multimedia")) { string mimeType = comp.BinaryContent.MultimediaType.MimeType; string filename = comp.BinaryContent.Filename;
//only for imagaes: gif, jpeg and png
if (mimeType.Contains("image") && !String.IsNullOrEmpty(filename))
{
messageLog.WriteEntry("OnComponentSavePre - resizing image - for component: " + comp.Title);
// need to save first new component to be able to get type in next step
if (args.IsNewItem)
{
comp.Save();
}
BinaryContent bc = comp.BinaryContent;
MemoryStream stream = new MemoryStream(bc.GetByteArray());
Image image = Image.FromStream(stream);
//reades multimedia fields
ItemFields itemFields = new ItemFields(comp.Metadata, comp.MetadataSchema);
if (itemFields.Contains("MM_Width"))
{
NumberField width = itemFields["MM_Width"] as NumberField;
if (width != null && width.Value <= 0)
{
.....Code to set width.....
}
}
if (itemFields.Contains("MM_Height"))
{
.....Code to set height.....
}
stream.Close();
comp.Metadata = itemFields.ToXml();
messageLog.WriteEntry("metadata updated", EventLogEntryType.Information, 0, 0);
}
}