Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stefan 117 posts 215 karma points
    Feb 01, 2012 @ 16:04
    Stefan
    0

    Problems with automatic crop

    Hi.

    I have just started working on a new site, and after a clean install of WebMatrix and Umbraco 4.7.1.1, the automatic cropping feature doesnt work when an image has been created.

    I have been working with DAMP on another recent project running Umbraco 4.7.1.

    I have added the two strings in web.config as shown:

      <appSettings>
        <add key="DAMP_CallImageCropper" value="true" />
        <add key="DAMP_OnlyIfEmpty" value="true" />
      </appSettings>

    I have also installed the Create Crops package, which does also not work. When I press the Create Crops button, I can see that it runs (very briefly), but it does not produce any crops.

    Any clues?
    Thanks in advance :)

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 01, 2012 @ 16:14
    Jeroen Breuer
    0

    That is strange. I've had another user who also had this problem. Not sure why actually. The image cropper has changed in 4.7.1.1, but I have a couple of sites running in 4.7.1.1 myself (upgraded from 4.7.1) and those work. Is there any error log or something?

    Jeroen

  • Stefan 117 posts 215 karma points
    Feb 01, 2012 @ 21:57
    Stefan
    0

    Well, I have just used the Log Manager to look for any errors, but did not found any.

    I also tried creating a new Umbraco 4.7.1.1 installation, with DAMP, DAMP samples, Create Crops and Custom MFU with no different result.

    When navigating the sample page, I get this error when on the razor page:
    Error loading MacroEngine script (file: DAMP-Razor.cshtml)

    On the XSLT sample page, only the classic sample is shown (since it does not have the crop datatype attached to it).

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 01, 2012 @ 22:00
    Jeroen Breuer
    0

    Yes you get that razor exception because no crops are created. This is a strange bug. I don't have a lot of time to look into it now. You could download the source here and debug it if you can: http://damp.codeplex.com/SourceControl/changeset/changes/81602.

    Jeroen

  • BarneyHall 141 posts 210 karma points
    Feb 13, 2012 @ 16:31
    BarneyHall
    0

    Hi I'm having the exact same problem on a fresh install of 4.7.1.1 including the DAMP samples.

    Would be great if you get a chance to fix the bug on 4.7.1.1 as looks like an amazing package.

    Many thanks,
    Barney

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 13, 2012 @ 16:36
    Jeroen Breuer
    0

    I really have no idea why this won't work. Can you download the source and debug it to see what might go wrong? The crops are created in the CallImagecropper method at the DAMP_Helper file.

    Jeroen

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Feb 15, 2012 @ 12:12
    Robert Foster
    0

    Hi Jeroen,

    I have the same problem, and after re-creating the CreateCrops dll I found the following exception:

       at System.Data.SqlServerCe.SqlCeDataReader.get_HasRows()
       at SqlCE4Umbraco.SqlCeDataReaderHelper.get_HasRecords()
       at CreateCrops.CC_Helper.CallImagecropper(Int32 mediaId) in [...]\CreateCrops\CC_Helper.cs:line 58
       at CreateCrops.CC_Helper.CreateCrops() in [..]\CreateCrops\CC_Helper.cs:line 36

    I'm using the SqlCE database that comes with Umbraco 4.7.1 and I had a suspicion that it might have been contributing to this issue since I've had CreateCrops and DAMP run nicely in the past on other installations.

    Changing CC_Helper.cs from

            public static bool CallImagecropper(int mediaId)
    {
    bool result = false;
    IDataType newObject = new Factory().GetNewObject(new System.Guid("7A2D436C-34C2-410F-898F-4A23B3D79F54"));
    string commandText = string.Format("\r\n select cpd.id as id, cpt.dataTypeId as datatypeid from cmsPropertyData cpd\r\n inner join cmsPropertyType cpt on cpd.propertytypeid = cpt.Id\r\n inner join cmsDataType cdt on cpt.dataTypeId = cdt.nodeId\r\n where cpd.contentNodeId = {0}\r\n and cdt.controlId = '{1}'", mediaId, newObject.Id);
    using (IRecordsReader recordsReader = CC_Helper.SqlHelper.ExecuteReader(commandText, new IParameter[0]))
    {
    if (recordsReader.HasRecords)
    {
    result = true;
    while (recordsReader.Read())
    {
    newObject.Data.PropertyId = recordsReader.GetInt("id");
    newObject.DataTypeDefinitionId = recordsReader.GetInt("datatypeid");
    CC_ImageCropper cC_ImageCropper = new CC_ImageCropper(newObject.Data, ((PrevalueEditor)newObject.PrevalueEditor).Configuration);
    cC_ImageCropper.Page = new Page();
    cC_ImageCropper.CallInit();
    cC_ImageCropper.Save();
    }
    }
    }
    return result;
    }

    to

            public static bool CallImagecropper(int mediaId)
    {
    bool result = false;
    IDataType newObject = new Factory().GetNewObject(new System.Guid("7A2D436C-34C2-410F-898F-4A23B3D79F54"));
    string commandText = string.Format("\r\n select cpd.id as id, cpt.dataTypeId as datatypeid from cmsPropertyData cpd\r\n inner join cmsPropertyType cpt on cpd.propertytypeid = cpt.Id\r\n inner join cmsDataType cdt on cpt.dataTypeId = cdt.nodeId\r\n where cpd.contentNodeId = {0}\r\n and cdt.controlId = '{1}'", mediaId, newObject.Id);
    using (IRecordsReader recordsReader = CC_Helper.SqlHelper.ExecuteReader(commandText, new IParameter[0]))
    {
    while (recordsReader.Read())
    {
    result = true;
    newObject.Data.PropertyId = recordsReader.GetInt("id");
    newObject.DataTypeDefinitionId = recordsReader.GetInt("datatypeid");
    CC_ImageCropper cC_ImageCropper = new CC_ImageCropper(newObject.Data, ((PrevalueEditor)newObject.PrevalueEditor).Configuration);
    cC_ImageCropper.Page = new Page();
    cC_ImageCropper.CallInit();
    cC_ImageCropper.Save();
    }
    }
    return result;
    }

    has fixed the problem.  I'm now going to go and make the equivalent change in DAMP and re-compile that as well...

    Rob.

  • Stefan 117 posts 215 karma points
    Feb 15, 2012 @ 12:28
    Stefan
    0

    Hi Robert.

    Nice to hear that you have found the problem! Would you please be so kind and share the recompiled files?

    Thank you!

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Feb 15, 2012 @ 12:35
    Robert Foster
    0

    Sure!

    But first a disclaimer:  This is in no way an official distribution of Jeroen's work - just a patch until he releases an official fix ;)

    For CreateCrops, download the dll (zipped) here: http://refactored.com.au/media/CreateCrops.zip

    for the DAMP 2.0 (based on the released version), download the replacement dll here: http://refactored.com.au/media/DigibizAdvancedMediaPicker.zip

    I make no warranties on the files at all :)  Nor do I make any claims.  Backup the existing files before replacing them first...

    Enjoy ;)

    Rob

     

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Feb 15, 2012 @ 12:36
    Robert Foster
    0

    I haven't tested the DAMP patch dll yet either, just so you know ;)  It should work though...

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 15, 2012 @ 13:19
    Jeroen Breuer
    0

    Great to see you got it fixed :). Will add the code to codeplex soon. Thanks!

    Jeroen

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Feb 15, 2012 @ 13:19
    Robert Foster
    0

    Anytime - I'll send you a bill :P

    - Rob.

Please Sign in or register to post replies

Write your reply to:

Draft