Microsoft Content Management Server - Accessing image data in an Image Placeholder on save

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > June 2006 > Accessing image data in an Image Placeholder on save





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 Accessing image data in an Image Placeholder on save
Andrew

2006-06-23, 7:24 am

Hi guys,

How can you access the image data when an ImagePlaceholder is saved?

I'm trying to customize SingleImagePlaceholderControl to resize the
uploaded image on the server, but I can't find a way to get access to
the image data and the inner workings of SavePlaceholderContent are a
mystery as the source code isn't provided.

The only examples of customisation to SingleImagePlaceholderControl
involve just using ImageUrl or using string replaces on the image tag
after it's been generated.

Once saved the image data seems to go into the BlobTable, if its not
practical to manipulate the image data before it's saved how can the
blob record be referenced (where does the guid used come from)?

Cheers
Andrew

Stefan [MSFT]

2006-06-23, 7:24 am

Hi Andrew,

it is not possible to access it directly.
You need to do a HttpRequest against the Src property of the placeholder
object and then consume the http response stream to get the content.

If the items is a resource gallery item you could extract the GUID from the
URL and use Searches.GetByGuid to access the resource object.
Here you would be able to open the item using the OpenReadStream method.
But this will not work for local attachments.

Cheers,
Stefan


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

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------


"Andrew" <andrewcrowe@gmail.com> wrote in message
news:1151057888.607259.192370@c74g2000cwc.googlegroups.com...
> Hi guys,
>
> How can you access the image data when an ImagePlaceholder is saved?
>
> I'm trying to customize SingleImagePlaceholderControl to resize the
> uploaded image on the server, but I can't find a way to get access to
> the image data and the inner workings of SavePlaceholderContent are a
> mystery as the source code isn't provided.
>
> The only examples of customisation to SingleImagePlaceholderControl
> involve just using ImageUrl or using string replaces on the image tag
> after it's been generated.
>
> Once saved the image data seems to go into the BlobTable, if its not
> practical to manipulate the image data before it's saved how can the
> blob record be referenced (where does the guid used come from)?
>
> Cheers
> Andrew
>



Andrew

2006-06-23, 1:18 pm

Ok cheers,

Looks like I'll have to approach from a slightly different angle,
perhaps as you say use HttpRequest, do the resize and then save it as a
blob in a new table and render from there instead.


Stefan [MSFT] wrote:[vbcol=seagreen]
> Hi Andrew,
>
> it is not possible to access it directly.
> You need to do a HttpRequest against the Src property of the placeholder
> object and then consume the http response stream to get the content.
>
> If the items is a resource gallery item you could extract the GUID from the
> URL and use Searches.GetByGuid to access the resource object.
> Here you would be able to open the item using the OpenReadStream method.
> But this will not work for local attachments.
>
> Cheers,
> Stefan
>
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
> Check out the new book as well: Advanced MCMS development:
> http://tinyurl.com/8ugwj
> ----------------------
>
>
> "Andrew" <andrewcrowe@gmail.com> wrote in message
> news:1151057888.607259.192370@c74g2000cwc.googlegroups.com...

Stefan [MSFT]

2006-06-23, 1:18 pm

Hi Andrew,

not necessarily.
I would suggest to consume the stream into an Image object, resize it here
and stream it from there.

No need for a database.

Cheers,
Stefan

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

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------


"Andrew" <andrewcrowe@gmail.com> wrote in message
news:1151071844.254674.243680@g10g2000cwb.googlegroups.com...
> Ok cheers,
>
> Looks like I'll have to approach from a slightly different angle,
> perhaps as you say use HttpRequest, do the resize and then save it as a
> blob in a new table and render from there instead.
>
>
> Stefan [MSFT] wrote:
>



Andrew

2006-06-23, 1:18 pm

It's going into a large site with thumbnail listing pages, so resizing
every image on the fly like that may create a noticeable performance
hit, at any rate it would seem more efficient to resize the image once
and then store the result rather then resizing every request.

Stefan [MSFT] wrote:[vbcol=seagreen]
> Hi Andrew,
>
> not necessarily.
> I would suggest to consume the stream into an Image object, resize it here
> and stream it from there.
>
> No need for a database.
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
> Check out the new book as well: Advanced MCMS development:
> http://tinyurl.com/8ugwj
> ----------------------
>
>
> "Andrew" <andrewcrowe@gmail.com> wrote in message
> news:1151071844.254674.243680@g10g2000cwb.googlegroups.com...

Stefan [MSFT]

2006-06-23, 7:19 pm

Hi Andrew,

ok, then you might want to upload the image in two sizes into the resource
gallery.
Or use the approach mentioend below - but ensure to use a separate database
for your blobs.

Cheers,
Stefan


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

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------


"Andrew" <andrewcrowe@gmail.com> wrote in message
news:1151078753.412152.305900@y41g2000cwy.googlegroups.com...
> It's going into a large site with thumbnail listing pages, so resizing
> every image on the fly like that may create a noticeable performance
> hit, at any rate it would seem more efficient to resize the image once
> and then store the result rather then resizing every request.
>
> Stefan [MSFT] wrote:
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com