Copied to clipboard

Flag this post as spam?

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


  • Joao Baptista 8 posts 58 karma points
    Mar 14, 2014 @ 13:43
    Joao Baptista
    0

    Override save button in custom package

    Hi guys

    I'm trying to extend the V7 image cropper by creating a new physical image on the server.

    The existing package works fine and saves the property data just fine, but I'd prefer crops to generate new files on the server without the overheard of image resizing and cropping in real time.

    Now, I've downloaded the source file and installed it correctly, but I cannot find the save button in the package views. So assuming that the save button comes from Umbraco. Is there any way to override what the save button does and if so are there any examples out there?

    I tried quite a few hours of googling, but could not find anything conclusive. This is my first time creating/extending packages, so any pointers would be awesome.

    Thank you

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Mar 14, 2014 @ 15:05
    Peter Gregory
    0

    Hey Joao

    I'm probably telling you something you already know but are you aware that the Umbraco 7 is using ImageProcessor behind the scenes? http://jimbobsquarepants.github.io/ImageProcessor/imageprocessor-web.html

    Image processor comes standard with caching so once it has cropped once it keeps a cache of the crop for the length specified in the config. If the image changes it updates the cache. So its not cropping everytime it loads, but only on first load.

    Hope that helps... Otherwise if you are still keen to create physical assets of each crop size you could look at adding an event to Umbraco that on save it takes the crop data and uses it to create the cropped versions you need using ImageProcessor http://jimbobsquarepants.github.io/ImageProcessor/imageprocessor.html

  • Joao Baptista 8 posts 58 karma points
    Mar 14, 2014 @ 15:09
    Joao Baptista
    0

    Hey Peter

    Thanks for replying. Yes, I'm aware, but it's really a project requirement that I'm dealing with. Is there any documentation on how to add an event to Umbraco? Sorry to be a pain, but this is really my first package... growing/starting pains! ;-)

    Thanks all!

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Mar 14, 2014 @ 15:26
    Peter Gregory
    1

    Yep sure is..

    check out http://our.umbraco.org/documentation/Reference/Events-v6/

    It applies to V7 Also. You want to look at the MediaService events :)

  • Joao Baptista 8 posts 58 karma points
    Mar 14, 2014 @ 15:30
    Joao Baptista
    0

    Thanks Peter! You're a star!

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Mar 14, 2014 @ 15:47
    Peter Gregory
    0

    Glad to help :)

  • Robert Mulder 79 posts 272 karma points c-trib
    Mar 20, 2014 @ 13:40
    Robert Mulder
    0

    Hey Peter, you mention that Umbraco uses the ImageProcessor behind the scenes. Is there anything in particular I need to do to use this?

    The link you refer to http://jimbobsquarepants.github.io/ImageProcessor/imageprocessor-web.html says that all you need to do is add some querystring variables to the image url, but when I use an image in the media section it doesn't do anything.

    For instance, when I change the url http://localhost/media/1001/someimage.png to http://localhost/media/1001/someimage.png?width=100 it doesn't do anything.

    Thanks in advance.

  • Robert Mulder 79 posts 272 karma points c-trib
    Mar 27, 2014 @ 12:48
    Robert Mulder
    0

    Anyone else maybe?

  • James Jackson-South 489 posts 1747 karma points c-trib
    Jul 08, 2014 @ 17:08
    James Jackson-South
    0

    I would double check that the HttpModule declarations are in the web.config as described here

    http://imageprocessor.org/imageprocessor-web/#webconfig

    There was a change in recent version to remove the RAMMFAR declaration to improve performance so the HttpModules could no longer be dynamically created. For some reason Nuget is sometimes (rarely) not transforming the web.config on update.

    Also, probably a daft question but what version of Umbraco are you running? I think it only got added from v7.1

  • Robert Mulder 79 posts 272 karma points c-trib
    Jul 08, 2014 @ 17:18
    Robert Mulder
    0

    It's been awhile so I'm not 100% certain, but I believe it was because Umbraco uses the ImageProcessor and ImageProcessor.Web NuGet packages, but you also need to include the ImageProcessor.Web.Config package.

    But like I said, it's been awhile so I may be mistaken.

  • James Jackson-South 489 posts 1747 karma points c-trib
    Aug 05, 2014 @ 17:08
    James Jackson-South
    0

    You only need the configuration package if you are changing settings.

    I would check the Umbraco version if you can and also the installed ImageProcessor package versions. I wrote the thing so I should be able to help.

Please Sign in or register to post replies

Write your reply to:

Draft