Copied to clipboard

Flag this post as spam?

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


  • Brad 94 posts 151 karma points
    Feb 18, 2010 @ 01:33
    Brad
    0

    Image upload - modifying the image after upload

    Me again.. Seems now that I have 2 sites running on Umbraco, I have a new question every day.. This really is the most friendly and useful forum ever.

    I'm looking at the ability of the TinyMCE editor to upload files.

    This works pretty nicely. Place the cursor, hit the button, upload the image, done.

    However, I want to resize the file after it is uploaded, before it appears on the site.

    The code to resize the image already have. Resize, crop, no problem

    My question is how to I get umbraco to run my code after the upload is finished.

    And if I create a new image (or more ) from the original image, what do I need to in Umbraco to make them valid media objects and possibly add more than one image tag in the markup.

    For example if I upload an image that is 2500 x 1800 called brad.jpg, I may want to create from that

    440 x 360  brad_large.jpg

    and

    110 x 90 brad_thumbnail.jpg. 

    Then put them in some code that shows the smaller image, but pops up the bigger image when you hover over it. (ie: not just the <img tag TinyMCE puts in for you now)

    Then delete the original image. I have the code to do all that. I just don't know how get it to run in here.

    Finally, I'd love to be able to modify the image upload dialog of TinyMCE so I have some checkboxes where the user can select what type of image they are uploading (something I could setup with different site images, like "Square Member Portrait", or "Medium sized page image" or whatever)

    I just need to know where to start looking to do this stuff in Umbraco.

    Brad

     

     

     

     

  • Daniel Lindstrom 454 posts 271 karma points
    Feb 18, 2010 @ 01:56
    Daniel Lindstrom
    0

    Take a look at http://www.percipientstudios.com/imagegen/overview.aspx

    It is used on many umbraco sites. It does dynamic resizing of images. You specify the image size in the image url in the html in the template/xslt/usercontrol. No need for the users to think about image sizes. Works great for images in fixed positions, not inserted via the rich text editor.

    There is also an image cropper datatype and the pixlr package in the project section.

    if you want to automatically resize on upload I think you should have a look at events. Media items expose the following events:

    BeforeSave

    AfterSave

    New

    BeforeDelete

    AfterDelete

  • Brad 94 posts 151 karma points
    Feb 18, 2010 @ 04:02
    Brad
    0

    Daniel

    I don't need dynamic image resizing. I have code to resize and crop the images. ie: I don't need to pay for someone elses code.(It does look nice however)

    But when you say 'look at the events', where do I do that? I am not that familiar with Umbraco under the covers.

    If I could just pointed in the right direction.

    Brad

  • Daniel Lindstrom 454 posts 271 karma points
    Feb 18, 2010 @ 04:48
    Daniel Lindstrom
    0

    Imagegen is free. Only the professional version is payware. As the resizing is done dynamically you or the content editors do not have to think about image sizes on upload. And if your layout changes and requires other dimensions for for example thumbnails etc you don not have to do anything to the images. just change the html, as the image size is determined by the image url.

    Anyway:

    For coding against the events you need some basic .net skills:

    http://www.richardsoeteman.net/PermaLink,guid,f470b6cf-40da-4aa9-a0d9-7b984fe9bf59.aspx

Please Sign in or register to post replies

Write your reply to:

Draft