This project is read-only.

auto-create crops on new media item.. crop tab empty although crop files are created..

Jan 31, 2014 at 12:00 PM
hi, just thought I'd post a little update that hacks a way around this..
basically for the specific create new media.. DAMP steps in and autcreates the crops but the UI crop tab doesn't show the crops until a refresh.
if (savedImageCropper.HasValue && savedImageCropper.Value == true)
                    {
                        CC_Helper.CallImagecropper(sender, true);                        
                        // maybe find the cropper control and recall it's init or hack a double refresh of the contentframe?
                        if (HttpContext.Current != null)
                        {
                            //after first save even though the crops are created we don't show in the crops tab
                            // contentPane has path /umbraco/editMedia.aspx?id=4418&isNew=true
                            // check for this and belt and braces that we are on the editMedia section redirect the contentpane to itself to show the media item and the crops.
                            if (HttpContext.Current.Request.Url.PathAndQuery.EndsWith("&isNew=true") && HttpContext.Current.Request.Url.PathAndQuery.Contains("/editMedia.aspx"))
                            {                                umbraco.BasePages.BasePage.Current.ClientTools.ChangeContentFrameUrl(String.Concat("editMedia.aspx?id=", sender.Id));
                            }
                        }
                    }
I'd love to know how robust you think this is :-)