Skip to content
This repository was archived by the owner on Feb 26, 2022. It is now read-only.
This repository was archived by the owner on Feb 26, 2022. It is now read-only.

ImagePoint with URL from label doesn't load image #11

Open

Description

@greystate

Not sure if I'm doing this wrong here, but I need to use a specific CropUp crop with the ImagePoint datatype, so I have a Media.BeforeSave event on my Image media type that updates a label property on the Image with the specific CropUp crop's URL.

I've then set the ImagePoint data type to use the label property instead of the standard umbracoFile property - but then the ImagePoint editor no longer shows an image (works fine - just no image since the src attribute is blank on the <img> tag).

I've double-checked that the URL stored on the label is in fact a URL for an image (though it's obviously fetched using CropUp's HTTPHandler - hmmm... could that be it? It's just the original URL prefixed with "/CropUp/somealias").

Activity

  1. greystate commented on Mar 26, 2014

    @greystate
    ContributorAuthor

    Just had a look at the source ("Oh no"! :) - and I suspect this line is the problem:

    string imagePath = HttpContext.Current.Server.MapPath(imageUrl);

    Server.MapPath() returns a local (physical) file path, right? So I can't use CropUp's "pretty" URLs (or any other "processed" images), it seems...

  2. greystate commented on Mar 27, 2014

    @greystate
    ContributorAuthor

    Upon even further inspection (just tell me to stop already ;) it seems the path from Server.MapPath() is only used to determine if a file exists (line 279) in that location (and to get the .Size, I guess) while the actual fetching of the image seems to use the original URL from the property...

  3. Hendy commented on Mar 27, 2014

    @Hendy
    Contributor

    Hi Chriztian, yes it loads in the image to get the size so that it can scale accordingly - we might be able to skip this if we specify the size in the ImagePoint configuration ? (or maybe it's possible to cheat and use your custom Media.BeforeSave event to save a physical file ?)

  4. greystate commented on Apr 1, 2014

    @greystate
    ContributorAuthor

    After some more testing and using it, I think the best option for setting this data type up is to always use the property where the original image is stored (which is almost always umbracoFile) - it makes the most sense to add points to the full image, regardless if you're using crops and not to actually displaying the full image.

    But I would suggest that the data type saves a local version of the image in the dimensions it's using, so it's possible to use large images without the browser having to scale it down...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions