You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "V. Jenks" <za...@gmail.com> on 2007/09/28 17:41:02 UTC

Displaying images remotely - HTML email

I've got a question concerning how I might be able to display remote images
in an HTML email.

In Wicket, I've built a small utility where our designers use a plain html
page to format our email newsletter.  The html template page and images
reside outside of the webroot because my app is deployed as an ear file. 
They have a maintenance page where they define a newsletter.  This page
reads the html file and saves the contents into a field in the Newsletter
table.  The newsletter contents which have been saved to the database is
what is sent to customers.

The problem arises when these newsletters are sent to customers.  Since the
images within the newsletter do not reside in the webroot, how would they be
displayed remotely?  After editing, when they preview the newsletter locally
I use the ResourceReference method of displaying the images outside of the
webroot.  Is there a way I can hard-code a remote URL to the images before I
persist it to the db?

What it boils down to is; I'm not familiar w/ HTML emails and I'm trying to
figure out how I should proceed so remote images can be displayed once the
email is sent to a customer.  

The answer may be obvious but I'm out of ideas at this point.

Thanks!
-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12943139
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by "V. Jenks" <za...@gmail.com>.
Correct, I had to actually go back and scan through the class since it's been
a year since I've even looked at it!

ImageResource derives from DynamicWebResource.  So, in the
getResourceState() method I hard-coded a line that tests for a specific path
(i.e. "C:\\MyApp\\assets\\images") - if it does not contain it I feed an
alternate image into it that says "Resource could not be found...etc.".

Hopefully this ensures that as long as there are nothing but images in the
path being tested for, there should be no risk of someone discovering other
resources outside of that path, correct?

Does this seem safe enough?

Thanks again, very helpful!!


Eelco Hillenius wrote:
> 
>> I don't see how I'd be able to do that sort of path?  I need to provide
>> the
>> full path for the reference to be found, since it's an external resource.
>> Obviously, I get a NullPointerException if I just type in what you show
>> in
>> your example.
> 
> You have imageResource registered as a shared resource, right? Unless
> I'm missing something, that class is something you or your collegues
> created yourselves, and it reads the "file" parameter to determine
> what needs to be served. All I'm proposing is to prepend whatever that
> file parameter returns with your base directory (just C:\ here).
> 
>> I must be missing something.  Either way, this could be a huge security
>> problem as I store other "assets" in these folders that definitely do
>> *not*
>> want users discovering or gaining access to.
> 
> Have that imageResource implementation check that the resource may be
> accessed. Deny by default. You're potentially opening up your whole
> server if you don't so be very careful with this.
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12949524
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by Eelco Hillenius <ee...@gmail.com>.
> I don't see how I'd be able to do that sort of path?  I need to provide the
> full path for the reference to be found, since it's an external resource.
> Obviously, I get a NullPointerException if I just type in what you show in
> your example.

You have imageResource registered as a shared resource, right? Unless
I'm missing something, that class is something you or your collegues
created yourselves, and it reads the "file" parameter to determine
what needs to be served. All I'm proposing is to prepend whatever that
file parameter returns with your base directory (just C:\ here).

> I must be missing something.  Either way, this could be a huge security
> problem as I store other "assets" in these folders that definitely do *not*
> want users discovering or gaining access to.

Have that imageResource implementation check that the resource may be
accessed. Deny by default. You're potentially opening up your whole
server if you don't so be very careful with this.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by "V. Jenks" <za...@gmail.com>.
I don't see how I'd be able to do that sort of path?  I need to provide the
full path for the reference to be found, since it's an external resource. 
Obviously, I get a NullPointerException if I just type in what you show in
your example.

I must be missing something.  Either way, this could be a huge security
problem as I store other "assets" in these folders that definitely do *not*
want users discovering or gaining access to.

Thanks again...


Eelco Hillenius wrote:
> 
>> By reusing the same code that I have been using to serve images inside of
>> the application, I can use to get a reference to the images w/ a full
>> URL,
>> like so:
>>
>> http://myurl/MyApp/home/resources/wicket.Application/imageResource?file=C:\\assets\\newsletter\\my_photo.jpg
>>
>> ...which I was able to discover because of this line in my init() in my
>> app
>> class:
>>
>> getSharedResources().add("imageResource", new ImageResource());
>>
>> Eelco's post got me thinking of that and it works.  Any reason I
>> shouldn't
>> do it this way?
> 
> No, that's pretty much what I meant. The only thing still is that you
> might want to use logical paths (e.g. relative to a root dir) so that
> you'll have
> 
> http://myurl/MyApp/home/resources/wicket.Application/imageResource?file=assets/newsletter/my_photo.jpg
> instead of exposing where on your server those images are exactly
> located.
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12946158
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by Eelco Hillenius <ee...@gmail.com>.
> By reusing the same code that I have been using to serve images inside of
> the application, I can use to get a reference to the images w/ a full URL,
> like so:
>
> http://myurl/MyApp/home/resources/wicket.Application/imageResource?file=C:\\assets\\newsletter\\my_photo.jpg
>
> ...which I was able to discover because of this line in my init() in my app
> class:
>
> getSharedResources().add("imageResource", new ImageResource());
>
> Eelco's post got me thinking of that and it works.  Any reason I shouldn't
> do it this way?

No, that's pretty much what I meant. The only thing still is that you
might want to use logical paths (e.g. relative to a root dir) so that
you'll have

http://myurl/MyApp/home/resources/wicket.Application/imageResource?file=assets/newsletter/my_photo.jpg
instead of exposing where on your server those images are exactly
located.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by "V. Jenks" <za...@gmail.com>.
Yes, sorry, I figured it out and I didn't need a servlet.

By reusing the same code that I have been using to serve images inside of
the application, I can use to get a reference to the images w/ a full URL,
like so:

http://myurl/MyApp/home/resources/wicket.Application/imageResource?file=C:\\assets\\newsletter\\my_photo.jpg

...which I was able to discover because of this line in my init() in my app
class:

getSharedResources().add("imageResource", new ImageResource());

Eelco's post got me thinking of that and it works.  Any reason I shouldn't
do it this way?

Thanks all, sorry for the ramble on such a simple thing...I don't get to use
Wicket much anymore...I'm a little rusty.


igor.vaynberg wrote:
> 
> wow, such a long thread for something so trivial
> 
> just create a servlet that streams files from some place on the harddrive,
> then have your designers upload images there. done and done.
> 
> -igor
> 
> 
> On 9/28/07, V. Jenks <za...@gmail.com> wrote:
>>
>>
>> No, this is not the case.  I specifically need these images to be
>> *outside*
>> of the packaged .ear application because I need our designers to have
>> access
>> to them.  Wicket access these resources and actually sends the contents
>> of
>> the html template.
>>
>> I am also stuck at Wicket 1.2.4 because upgrading has thrown a bunch of
>> errors and I just do not have time to figure out the differences in the
>> later releases, this app has to be done today and I'm on the very last
>> feature, which is getting remote images to resolve through an HTML email,
>> which do not reside in the .ear (and therefore do not have their own
>> hard-coded, publicly-available URL).
>>
>> I can send the email, I'm just at the point where I need how to figure
>> out
>> how to get the non-packaged image resources to show up to customers who
>> receive it.
>>
>>
>> Craig Tataryn wrote:
>> >
>> > If I'm understanding this correctly you simply want a set of images
>> > available on the same server that your wicket app is on.  Just make an
>> > "images" folder at the same level as WEB-INF (that is, a sibling of).
>> >
>> > If you are using wicket 1.2.x, you would have mounted your wicket app
>> > to some path under your context: for instance /app.  A link to a
>> > wicket page mounted to /home would look like this:
>> >
>> > http://yourserver.com/yourcontext/app/home
>> >
>> > A link to an image would look like this:
>> > http://yourserver.com/yourcontext/images/myimage.jpg
>> >
>> > On Wicket 1.3, you use a filter instead, and the filter is smart
>> > enough to know what content to handle so technically you don't need
>> > the extra /app path you can reference your application and static
>> > images like so:
>> >
>> > http://yourserver.com/yourcontext/home
>> >
>> > http://yourserver.com/yourcontext/images/myimage.jpg (it's the same as
>> > before)
>> >
>> > Again, not sure if that's what you are asking, but hopefully it is!
>> >
>> > Craig.
>> >
>> > On 9/28/07, V. Jenks <za...@gmail.com> wrote:
>> >>
>> >> Basically, yes.  I wasn't sure if there was a Wicket solution to this
>> >> problem
>> >> or not.  I wasn't sure if there was a way to make a hard-coded
>> reference
>> >> to
>> >> a resource outside of the webroot, for the purposes of doing what I
>> >> explained.
>> >>
>> >>
>> >> Eelco Hillenius wrote:
>> >> >
>> >> >> Interesting...  This might work, however I don't understand what
>> the
>> >> >> class
>> >> >> would be?  Would it be the Application class?  The images reside in
>> >> >> C:\AppName\images, which is obviously outside of the app.
>> >> >
>> >> > Oh, ok, I didn't understand what you meant. So you don't want to
>> just
>> >> > put these images in a path than can be served by a web server?
>> >> >
>> >> > Eelco
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12944856
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12945183
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12945714
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by Igor Vaynberg <ig...@gmail.com>.
wow, such a long thread for something so trivial

just create a servlet that streams files from some place on the harddrive,
then have your designers upload images there. done and done.

-igor


On 9/28/07, V. Jenks <za...@gmail.com> wrote:
>
>
> No, this is not the case.  I specifically need these images to be
> *outside*
> of the packaged .ear application because I need our designers to have
> access
> to them.  Wicket access these resources and actually sends the contents of
> the html template.
>
> I am also stuck at Wicket 1.2.4 because upgrading has thrown a bunch of
> errors and I just do not have time to figure out the differences in the
> later releases, this app has to be done today and I'm on the very last
> feature, which is getting remote images to resolve through an HTML email,
> which do not reside in the .ear (and therefore do not have their own
> hard-coded, publicly-available URL).
>
> I can send the email, I'm just at the point where I need how to figure out
> how to get the non-packaged image resources to show up to customers who
> receive it.
>
>
> Craig Tataryn wrote:
> >
> > If I'm understanding this correctly you simply want a set of images
> > available on the same server that your wicket app is on.  Just make an
> > "images" folder at the same level as WEB-INF (that is, a sibling of).
> >
> > If you are using wicket 1.2.x, you would have mounted your wicket app
> > to some path under your context: for instance /app.  A link to a
> > wicket page mounted to /home would look like this:
> >
> > http://yourserver.com/yourcontext/app/home
> >
> > A link to an image would look like this:
> > http://yourserver.com/yourcontext/images/myimage.jpg
> >
> > On Wicket 1.3, you use a filter instead, and the filter is smart
> > enough to know what content to handle so technically you don't need
> > the extra /app path you can reference your application and static
> > images like so:
> >
> > http://yourserver.com/yourcontext/home
> >
> > http://yourserver.com/yourcontext/images/myimage.jpg (it's the same as
> > before)
> >
> > Again, not sure if that's what you are asking, but hopefully it is!
> >
> > Craig.
> >
> > On 9/28/07, V. Jenks <za...@gmail.com> wrote:
> >>
> >> Basically, yes.  I wasn't sure if there was a Wicket solution to this
> >> problem
> >> or not.  I wasn't sure if there was a way to make a hard-coded
> reference
> >> to
> >> a resource outside of the webroot, for the purposes of doing what I
> >> explained.
> >>
> >>
> >> Eelco Hillenius wrote:
> >> >
> >> >> Interesting...  This might work, however I don't understand what the
> >> >> class
> >> >> would be?  Would it be the Application class?  The images reside in
> >> >> C:\AppName\images, which is obviously outside of the app.
> >> >
> >> > Oh, ok, I didn't understand what you meant. So you don't want to just
> >> > put these images in a path than can be served by a web server?
> >> >
> >> > Eelco
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12944856
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12945183
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Displaying images remotely - HTML email

Posted by "V. Jenks" <za...@gmail.com>.
No, this is not the case.  I specifically need these images to be *outside*
of the packaged .ear application because I need our designers to have access
to them.  Wicket access these resources and actually sends the contents of
the html template.

I am also stuck at Wicket 1.2.4 because upgrading has thrown a bunch of
errors and I just do not have time to figure out the differences in the
later releases, this app has to be done today and I'm on the very last
feature, which is getting remote images to resolve through an HTML email,
which do not reside in the .ear (and therefore do not have their own
hard-coded, publicly-available URL).

I can send the email, I'm just at the point where I need how to figure out
how to get the non-packaged image resources to show up to customers who
receive it.


Craig Tataryn wrote:
> 
> If I'm understanding this correctly you simply want a set of images
> available on the same server that your wicket app is on.  Just make an
> "images" folder at the same level as WEB-INF (that is, a sibling of).
> 
> If you are using wicket 1.2.x, you would have mounted your wicket app
> to some path under your context: for instance /app.  A link to a
> wicket page mounted to /home would look like this:
> 
> http://yourserver.com/yourcontext/app/home
> 
> A link to an image would look like this:
> http://yourserver.com/yourcontext/images/myimage.jpg
> 
> On Wicket 1.3, you use a filter instead, and the filter is smart
> enough to know what content to handle so technically you don't need
> the extra /app path you can reference your application and static
> images like so:
> 
> http://yourserver.com/yourcontext/home
> 
> http://yourserver.com/yourcontext/images/myimage.jpg (it's the same as
> before)
> 
> Again, not sure if that's what you are asking, but hopefully it is!
> 
> Craig.
> 
> On 9/28/07, V. Jenks <za...@gmail.com> wrote:
>>
>> Basically, yes.  I wasn't sure if there was a Wicket solution to this
>> problem
>> or not.  I wasn't sure if there was a way to make a hard-coded reference
>> to
>> a resource outside of the webroot, for the purposes of doing what I
>> explained.
>>
>>
>> Eelco Hillenius wrote:
>> >
>> >> Interesting...  This might work, however I don't understand what the
>> >> class
>> >> would be?  Would it be the Application class?  The images reside in
>> >> C:\AppName\images, which is obviously outside of the app.
>> >
>> > Oh, ok, I didn't understand what you meant. So you don't want to just
>> > put these images in a path than can be served by a web server?
>> >
>> > Eelco
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12944856
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12945183
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by Craig Tataryn <cr...@tataryn.net>.
If I'm understanding this correctly you simply want a set of images
available on the same server that your wicket app is on.  Just make an
"images" folder at the same level as WEB-INF (that is, a sibling of).

If you are using wicket 1.2.x, you would have mounted your wicket app
to some path under your context: for instance /app.  A link to a
wicket page mounted to /home would look like this:

http://yourserver.com/yourcontext/app/home

A link to an image would look like this:
http://yourserver.com/yourcontext/images/myimage.jpg

On Wicket 1.3, you use a filter instead, and the filter is smart
enough to know what content to handle so technically you don't need
the extra /app path you can reference your application and static
images like so:

http://yourserver.com/yourcontext/home

http://yourserver.com/yourcontext/images/myimage.jpg (it's the same as before)

Again, not sure if that's what you are asking, but hopefully it is!

Craig.

On 9/28/07, V. Jenks <za...@gmail.com> wrote:
>
> Basically, yes.  I wasn't sure if there was a Wicket solution to this problem
> or not.  I wasn't sure if there was a way to make a hard-coded reference to
> a resource outside of the webroot, for the purposes of doing what I
> explained.
>
>
> Eelco Hillenius wrote:
> >
> >> Interesting...  This might work, however I don't understand what the
> >> class
> >> would be?  Would it be the Application class?  The images reside in
> >> C:\AppName\images, which is obviously outside of the app.
> >
> > Oh, ok, I didn't understand what you meant. So you don't want to just
> > put these images in a path than can be served by a web server?
> >
> > Eelco
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12944856
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by "V. Jenks" <za...@gmail.com>.
I've tried searching "FileResourceStream" and "shared resource" but there
isn't anything helpful...or even relevant, so far as I can tell.

Is there a wiki article by any chance?  Anything that might help?  I'm not
sure what this servlet would do or how to implement this.


Eelco Hillenius wrote:
> 
>> Basically, yes.  I wasn't sure if there was a Wicket solution to this
>> problem
>> or not.  I wasn't sure if there was a way to make a hard-coded reference
>> to
>> a resource outside of the webroot, for the purposes of doing what I
>> explained.
> 
> What you can do is create a shared resource and let it resolve to your
> files using e.g. FileResourceStream. Or even create a simple Servlet.
> We've had discussions on this a few times on the list so maybe you can
> try to find a solution in the archives.
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12945343
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by Eelco Hillenius <ee...@gmail.com>.
> Basically, yes.  I wasn't sure if there was a Wicket solution to this problem
> or not.  I wasn't sure if there was a way to make a hard-coded reference to
> a resource outside of the webroot, for the purposes of doing what I
> explained.

What you can do is create a shared resource and let it resolve to your
files using e.g. FileResourceStream. Or even create a simple Servlet.
We've had discussions on this a few times on the list so maybe you can
try to find a solution in the archives.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by "V. Jenks" <za...@gmail.com>.
Basically, yes.  I wasn't sure if there was a Wicket solution to this problem
or not.  I wasn't sure if there was a way to make a hard-coded reference to
a resource outside of the webroot, for the purposes of doing what I
explained.


Eelco Hillenius wrote:
> 
>> Interesting...  This might work, however I don't understand what the
>> class
>> would be?  Would it be the Application class?  The images reside in
>> C:\AppName\images, which is obviously outside of the app.
> 
> Oh, ok, I didn't understand what you meant. So you don't want to just
> put these images in a path than can be served by a web server?
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12944856
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by Eelco Hillenius <ee...@gmail.com>.
> Interesting...  This might work, however I don't understand what the class
> would be?  Would it be the Application class?  The images reside in
> C:\AppName\images, which is obviously outside of the app.

Oh, ok, I didn't understand what you meant. So you don't want to just
put these images in a path than can be served by a web server?

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by "V. Jenks" <za...@gmail.com>.


Eelco Hillenius wrote:
> 
> Not sure if it is the answer you are looking for, but paths to shared
> resources (which packaged resources such as images are) are
> predictable. Basically:
> 
> http://your.com/yourapp/resources/com.your.another.package.SomeClass/your_image_next_to_your_class.gif
> 
> So there is /resources/ which is a reserved path for shared resources
> in Wicket. Then there is the name of the class you want to use to
> relatively reference your resource, and then there is the resource
> relative to that class. And that can be in a subdir, but you can't use
> '..' etc.
> 
> Eelco
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

Interesting...  This might work, however I don't understand what the class
would be?  Would it be the Application class?  The images reside in
C:\AppName\images, which is obviously outside of the app.

I suppose I don't quite understand how that would work?

-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12943828
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by Eelco Hillenius <ee...@gmail.com>.
On 9/28/07, V. Jenks <za...@gmail.com> wrote:
>
> I've got a question concerning how I might be able to display remote images
> in an HTML email.
>
> In Wicket, I've built a small utility where our designers use a plain html
> page to format our email newsletter.  The html template page and images
> reside outside of the webroot because my app is deployed as an ear file.
> They have a maintenance page where they define a newsletter.  This page
> reads the html file and saves the contents into a field in the Newsletter
> table.  The newsletter contents which have been saved to the database is
> what is sent to customers.
>
> The problem arises when these newsletters are sent to customers.  Since the
> images within the newsletter do not reside in the webroot, how would they be
> displayed remotely?  After editing, when they preview the newsletter locally
> I use the ResourceReference method of displaying the images outside of the
> webroot.  Is there a way I can hard-code a remote URL to the images before I
> persist it to the db?
>
> What it boils down to is; I'm not familiar w/ HTML emails and I'm trying to
> figure out how I should proceed so remote images can be displayed once the
> email is sent to a customer.
>
> The answer may be obvious but I'm out of ideas at this point.

Not sure if it is the answer you are looking for, but paths to shared
resources (which packaged resources such as images are) are
predictable. Basically:

http://your.com/yourapp/resources/com.your.another.package.SomeClass/your_image_next_to_your_class.gif

So there is /resources/ which is a reserved path for shared resources
in Wicket. Then there is the name of the class you want to use to
relatively reference your resource, and then there is the resource
relative to that class. And that can be in a subdir, but you can't use
'..' etc.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by "V. Jenks" <za...@gmail.com>.


Sam Hough wrote:
> 
> The other is, as you say, to put the images on a public facing server. Do
> you have some key that you can use to reference the images from within
> editing and for the live server? Maybe have a non-ear webapp for serving
> the images? or serve them out of the database?
> 

This sounds like the way to go.  I could just have them assemble the
newsletter using an HTML editor and before they publish it, they'd have to
upload the images to a directory on one of the web sites, hardcoding that
URL into the email.

Thanks Sam.
-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12943721
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Displaying images remotely - HTML email

Posted by Sam Hough <sa...@redspr.com>.
Big snag is most email clients will never show the images due to security
problems.

I think you have two options. One it to attach the images in the actual
email (if they are small) so you would need to learn the joys of multipart
messages (are using sending plain text and HTML version?).

The other is, as you say, to put the images on a public facing server. Do
you have some key that you can use to reference the images from within
editing and for the live server? Maybe have a non-ear webapp for serving the
images? or serve them out of the database?
 


V. Jenks wrote:
> 
> I've got a question concerning how I might be able to display remote
> images in an HTML email.
> 
> In Wicket, I've built a small utility where our designers use a plain html
> page to format our email newsletter.  The html template page and images
> reside outside of the webroot because my app is deployed as an ear file. 
> They have a maintenance page where they define a newsletter.  This page
> reads the html file and saves the contents into a field in the Newsletter
> table.  The newsletter contents which have been saved to the database is
> what is sent to customers.
> 
> The problem arises when these newsletters are sent to customers.  Since
> the images within the newsletter do not reside in the webroot, how would
> they be displayed remotely?  After editing, when they preview the
> newsletter locally I use the ResourceReference method of displaying the
> images outside of the webroot.  Is there a way I can hard-code a remote
> URL to the images before I persist it to the db?
> 
> What it boils down to is; I'm not familiar w/ HTML emails and I'm trying
> to figure out how I should proceed so remote images can be displayed once
> the email is sent to a customer.  
> 
> The answer may be obvious but I'm out of ideas at this point.
> 
> Thanks!
> 

-- 
View this message in context: http://www.nabble.com/Displaying-images-remotely---HTML-email-tf4535313.html#a12943374
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org