Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 21, 2011 @ 14:45
    Fuji Kusaka
    0

    Image not being displayed when creating a Media Type

    Hi all,

    I have something weird happening when trying to display images from my media section.

    Well I created a new Media Type under my settings section with the following type Upload, UmbracoExtenion, UmbracoWidth, UmbracoHeight and UmbracoBytes. To this I added a Tab under which i have an Image Cropper.

    So basically the new Media Type created is pretty much the same as the Image Media Type only the name was associated to the project.

    But now when I add Macro to the template I somehow can get the Images to display when using the New Media Type. With the custom Image one the images are displayed.

    Can someone point out why this is not working?

     

    //fuji

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 22, 2011 @ 13:49
    Fuji Kusaka
    0

    Same issue when creating a Media Type for pdf.  I cant possibly display the pdfs created using the Media Type "pdf" but when using the "file" one it works perfectly.

    Any Suggestion please?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Sep 22, 2011 @ 14:04
    Tom Fulton
    1

    Hi Fuji,

    The custom media types should work the same as the built in ones.  Normally you will want to keep your "upload" field named "umbracoFile" - did you do that?  If not make sure to adjust your macro to read the correct alias of the upload field to show the image/file.

    If you are still having problems you can try dumping the XML to a textarea so you can see what's going on with your properties - <textarea><xsl:copy-of select="umbraco.library:GetMedia(xxxx,false())"/></textarea>

    If you are still having problems try posting your macro's code here along with the above output.  Maybe your macro has a hardcoded reference to "File" or "Image"?

    -Tom

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 22, 2011 @ 14:23
    Fuji Kusaka
    0

    Hi Tom,

    Well am using the same basic property as the Custom Media Type "File" only the name will change according to the demand of the client.

    umbracoFile, umbracoExtension and umbracoBytes. My macro works perfectly when i used the media type (file).

    When using

       <textarea><xsl:copy-of select="umbraco.library:GetMedia($mediaFolder/*/@id,false())"/></textarea>
    <Folder id="1301" version="a47fce06-53ed-4b75-b2da-e7d650a50dc2" parentID="1300" level="3" writerID="0" nodeType="1031" template="0" sortOrder="1" createDate="2011-09-20T13:07:47" updateDate="2011-09-20T13:07:47" nodeName="Latest" urlName="latest" writerName="admin" nodeTypeAlias="Folder" path="-1,1280,1300,1301"><contents /></Folder>
  • Tom Fulton 2030 posts 4998 karma points c-trib
    Sep 22, 2011 @ 14:26
    Tom Fulton
    0

    Oh ok, if you are looping from the folder change the false() to true() so it includes the child items.

    Then my guess is that your loop is doing something like umbraco.library:GetMedia($mediaFolder/*/@id, true())/File instead of umbraco.library:GetMedia($mediaFolder/*/@id, true())/PDF

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 22, 2011 @ 14:39
    Fuji Kusaka
    0

    Yes am using

    <xsl:variable name="mediaItems" select="umbraco.library:GetMedia($mediaFolder/*/@id, true())"/>

    but when i changed it to

    <xsl:variable name="mediaItems" select="umbraco.library:GetMedia($mediaFolder/*/@id, true())/Pdf"/>

    I get nothing

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Sep 22, 2011 @ 14:40
    Tom Fulton
    0

    That should work, can you post the output of:

    <textarea><xsl:copy-of select="umbraco.library:GetMedia($mediaFolder/*/@id, true())"/></textarea>

  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 22, 2011 @ 14:42
    Fuji Kusaka
    0

    Here is the output

    <Folder id="1301" version="a47fce06-53ed-4b75-b2da-e7d650a50dc2" parentID="1300" level="3" writerID="0" nodeType="1031" template="0" sortOrder="1" createDate="2011-09-20T13:07:47" updateDate="2011-09-20T13:07:47" nodeName="Latest" urlName="latest" writerName="admin" nodeTypeAlias="Folder" path="-1,1280,1300,1301"><contents /><File id="1343" version="494a0ffa-48a3-4a6d-8306-81a2aa03c8d9" parentID="1301" level="4" writerID="0" nodeType="1033" template="0" sortOrder="1" createDate="2011-09-22T15:56:35" updateDate="2011-09-22T15:56:36" nodeName="Jeff Butterworth appointed as Chief Spa & Wellness Officer" urlName="jeffbutterworthappointedaschiefspa&wellnessofficer" writerName="admin" nodeTypeAlias="File" path="-1,1280,1300,1301,1343"><umbracoFile>/media/3758/prappointmentjeffblocal.pdf</umbracoFile><umbracoExtension>pdf</umbracoExtension><umbracoBytes>150592</umbracoBytes></File><Pdf id="1344" version="dd631c97-186b-4dc4-8524-90bd9965f373" parentID="1301" level="4" writerID="0" nodeType="1307" template="0" sortOrder="2" createDate="2011-09-22T16:05:33" updateDate="2011-09-22T16:05:33" nodeName="Stephane Brallet appointed as Executive Chef of Legends" urlName="stephanebralletappointedasexecutivechefoflegends" writerName="admin" nodeTypeAlias="Pdf" path="-1,1280,1300,1301,1344"><umbracoFile>/media/3761/appointmentstephanebrallet.pdf</umbracoFile><umbracoExtension>pdf</umbracoExtension><umbracoBytes>399423</umbracoBytes></Pdf><Pdf id="1346" version="3ea20bb0-4273-461c-a6e1-9be1a2e4f8c9" parentID="1301" level="4" writerID="0" nodeType="1307" template="0" sortOrder="3" createDate="2011-09-22T16:36:37" updateDate="2011-09-22T16:36:37" nodeName="etwet" urlName="etwet" writerName="admin" nodeTypeAlias="Pdf" path="-1,1280,1300,1301,1346"><umbracoFile>/media/3767/prpostmarathon010711.pdf</umbracoFile><umbracoExtension>pdf</umbracoExtension><umbracoBytes>120848</umbracoBytes></Pdf><File id="1347" version="cfd90662-7951-47e6-9331-b0dda069b872" parentID="1301" level="4" writerID="0" nodeType="1033" template="0" sortOrder="4" createDate="2011-09-22T16:46:47" updateDate="2011-09-22T16:46:47" nodeName="dsfdsf" urlName="dsfdsf" writerName="admin" nodeTypeAlias="File" path="-1,1280,1300,1301,1347"><umbracoFile /><umbracoExtension /><umbracoBytes /></File></Folder>
  • Fuji Kusaka 2203 posts 4220 karma points
    Sep 22, 2011 @ 14:47
    Fuji Kusaka
    0

    Tom I got it working...

    Here is my mistake

      <xsl:for-each select="$mediaItems/File">

    Instead i should be using

      <xsl:for-each select="$mediaItems/Pdf">

    But thanks again for the help.

    //fuji

Please Sign in or register to post replies

Write your reply to:

Draft