Copied to clipboard

Flag this post as spam?

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


  • dominik 711 posts 733 karma points
    Mar 22, 2011 @ 12:30
    dominik
    0

    Image Upload edit width and height

    Hello everybody,

    I got some width and height property as label. If i upload an image the label get the correct information for width and height. Now I wanted to edit this information and make a textfield out of the label property.

    But if I upload the image the first time this two fields are not filled with the default sizes.

    Is there a way to use default sizes of the uploaded image but also be able to edit the sizes after uploading?

    Without any width and height the Internet Explorer only displays the image in 1x1px

     

    Thanks

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 22, 2011 @ 12:37
    Jan Skovgaard
    0

    Hi dominik

    Do you upload the image in the media section or in the content section with a upload property?

    /Jan

  • dominik 711 posts 733 karma points
    Mar 22, 2011 @ 12:39
    dominik
    0

    i uploaded it in the media section

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 22, 2011 @ 22:14
    Jan Skovgaard
    0

    Hi Dominik

    What version of Umbraco are you using?

    And is the height and with not filled in with the correct dimensions? (Sorry if I'm being a bit slow here, but I'm not sure I fully understand what it is you're trying to achieve and what it is that's bugging).

    /Jan

  • dominik 711 posts 733 karma points
    Mar 23, 2011 @ 08:20
    dominik
    0

    So my problem is i first used label properties to get the width and the height of the image. But sometimes i want to change this sizes so i changed property to "textstring" or "number" but if i change and upload an image the default values of widht and height of the image are not entered into this fields.

    How can i use the width and the height of the uploaded image but also be able to change / edit it

    My umbraco version is 4.5

    Thanks

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 23, 2011 @ 13:19
    Tom Fulton
    0

    Hi Dominik,

    It doesn't look like Umbraco will update those values unless they are "Labels".  Actually, I think it updates them but they probably get overwritten right away the values already entered when clicking save.  The Upload Field is hardcoded to work with labels.

    If you really need to enter custom values, I might suggest adding two extra fields like "Alternate Width" and "Alternate Height", and check to see if these are filled out when you display the image.

    On a side note though, I'm not exactly sure why you would want to change these values in the first place :)  Perhaps there might be a better way to achieve what you are trying?

  • dominik 711 posts 733 karma points
    Mar 23, 2011 @ 13:28
    dominik
    0

    So the problem is that the person that upload the images are not familial with resizing of images with a special program so I thought it would be nice if umbraco paste the default sizes into two textfields (height and width) and the user can edit it if neccessary.

    But i will try your mentioned solution with alternative widht and height

     

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 23, 2011 @ 13:33
    Tom Fulton
    1

    Hi Dominik,

    Typically I like to control the size of the image myself (as the site developer).  For example on a product listing page I want all the images to either be the same height or width, I wouldn't want the editor trying to decide what they should be.  As you said the user is not familiar with image resizing, and in that case I don't think they'd be familiar with pixel sizes anyway.  Plus it would be hard for them to keep them proportional. 

    For image resizing you can use the wonderful ImageGen package.  In this example I could specify I want a "max width" of 100 and "max height" of 100, and it will resize the image proportionally on the fly, from my product listing code.  Perhaps this might be a better solution for you?

    -Tom

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 23, 2011 @ 22:53
    Jan Skovgaard
    0

    Hi Dominik

    As Tom is saying ImageGen is a better solution. I don't think that editors should be concerned about the image sizes since they're mostly standard.

    However you can of course use ImageGen in combination with some properties on the image document type for width and height where you can allow the editor to overwrite the default value that you're using in the code.

    I imagine that you can create a variable in your xslt file like this for instance

    <xsl:variable name="width">
    <xsl:choose>
    <xsl:when test="widthpropertyonyourimage !=''"><xsl:value-of select="widthpropertyonyourimage" /></xsl:when>
    <xsl:otherwise>100</xsl:otherwise> <!-- Default value -->
    </xsl:choose>
    </xsl:variable>

    <xsl:variable name="height">
    <xsl:choose>
    <xsl:when test="heightpropertyonyourimage !=''"><xsl:value-of select="heightpropertyonyourimage" /></xsl:when>
    <xsl:otherwise>100</xsl:otherwise> <!-- Default value -->
    </xsl:choose>
    </xsl:variable>

    Then you can use these variables in combination with ImageGen.

    I hope this helps.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft