Microsoft Content Management Server - Create a image placholder programmatically

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > September 2004 > Create a image placholder programmatically





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Create a image placholder programmatically
Ching

2004-09-15, 10:20 am

Hi Stefan,

I have read your "Create a template definition programmatically including
placeholder definitions", but I want to insert a image to the image
placholder programmatically. Assume I got a bitmap file, how to perform a
insert action programmatically?

Thanks!

Regards,
Ching


Stefan [MSFT]

2004-09-15, 10:20 am

Hi Ching,

depends if you would like to do this from a resource gallery or as a local
image.

Resource Gallery:
==================

Resource rs = cmsContext.Searches.GetByPath(ImagePathInResourceGallery)
as Resource;
if ( rs == null )
{
return "Could not find resource " + ImagePathInResourceGallery + ".";
}

ImagePlaceholder imgph = newPosting.Placeholders["Image"] as
ImagePlaceholder;
imgph.Src = rs.Url;



Local Image:
==================

string URL = cmsContext.AcceptBinaryFile(ImageFilePath);

ImagePlaceholder imgph = newPosting.Placeholders["ImgPh"] as
ImagePlaceholder;
imgph.Src = URL;


Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Ching" <ching.siu@agenda-asia.com> wrote in message
news:#Sdzm8jmEHA.3900@TK2MSFTNGP10.phx.gbl...
> Hi Stefan,
>
> I have read your "Create a template definition programmatically

including
> placeholder definitions", but I want to insert a image to the image
> placholder programmatically. Assume I got a bitmap file, how to perform a
> insert action programmatically?
>
> Thanks!
>
> Regards,
> Ching
>
>



Ching

2004-09-15, 10:20 am

how about if I have the bitmap stream already?

or if the image is a URL indeed, say http://www.google.com/image.jpg?

can it still be passed to cmsContext.AcceptBinaryFile()?



"Stefan [MSFT]" <stefang@online.microsoft.com> 撰寫於郵件新聞:eV$Z3%23jmEHA.3332@TK2MSFTNGP10.phx.gbl...
> Hi Ching,
>
> depends if you would like to do this from a resource gallery or as a local
> image.
>
> Resource Gallery:
> ==================
>
> Resource rs = cmsContext.Searches.GetByPath(ImagePathInResourceGallery)
> as Resource;
> if ( rs == null )
> {
> return "Could not find resource " + ImagePathInResourceGallery + ".";
> }
>
> ImagePlaceholder imgph = newPosting.Placeholders["Image"] as
> ImagePlaceholder;
> imgph.Src = rs.Url;
>
>
>
> Local Image:
> ==================
>
> string URL = cmsContext.AcceptBinaryFile(ImageFilePath);
>
> ImagePlaceholder imgph = newPosting.Placeholders["ImgPh"] as
> ImagePlaceholder;
> imgph.Src = URL;
>
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> MCMS FAQ:
> http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
> http://www.gotdotnet.com/community/...t+S
erver

> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "Ching" <ching.siu@agenda-asia.com> wrote in message
> news:#Sdzm8jmEHA.3900@TK2MSFTNGP10.phx.gbl...
> including
>
>



Stefan [MSFT]

2004-09-15, 10:20 am

Hi Ching,

no. AcceptBinaryFile expects to have the file on your disk.
You need to copy it to a temp folder, upload and delete.
This is what MCMS web author also does when you upload an image from a
client machine.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Ching" <ching.siu@agenda-asia.com> wrote in message
news:#XGthOkmEHA.3396@tk2msftngp13.phx.gbl...
> how about if I have the bitmap stream already?
>
> or if the image is a URL indeed, say http://www.google.com/image.jpg?
>
> can it still be passed to cmsContext.AcceptBinaryFile()?
>
>
>
> "Stefan [MSFT]" <stefang@online.microsoft.com>

撰寫於郵件新聞:eV$Z3%23jmEHA.3332@TK2MSFTNGP10.phx.gbl...
local[vbcol=seagreen]
cmsContext.Searches. GetByPath(ImagePathInResourceGallery)[vb
col=seagreen]
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm[vbcol=seagreen]
http://www.gotdotnet.com/community/...t+S
erver
[vbcol=seagreen]
a[vbcol=seagreen]
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com