Re: Background image in css for email from component
Re: Background image in css for email from component
- Subject: Re: Background image in css for email from component
- From: Johann Werner <email@hidden>
- Date: Wed, 26 Jun 2013 22:36:10 +0200
Don't hardcode the hostname! As always there's a method for that in Wonder:
String relativeUrl = …
String absoluteUrl = ERXResourceManager._completeURLForResource(relativeUrl, null, context);
jw
Am 26.06.2013 um 22:18 schrieb Johnny Miller <email@hidden>:
> I would have a property like:
>
> myhost=http://127.0.0.1/
>
> and then in my properties.deployment I would have
>
> myhost=http://www.mydomain.com/
>
> And then prepend that to my url.
>
> HTH,
>
> Johnny
>
>
> On Jun 26, 2013, at 10:04 AM, Ken Anderson <email@hidden> wrote:
>
>> Thanks Johnny… but until I can find resources I'm still stuck…
>>
>> But I will certainly try a different approach.
>>
>> Ken
>>
>>
>> On Jun 26, 2013, at 3:55 PM, Johnny Miller <email@hidden> wrote:
>>
>>> Also: http://www.campaignmonitor.com/css/
>>>
>>> What a surprise? Outlook doesn't support background images! IDK if that influences your design though.
>>>
>>> But if it were me I would try using an absolutely positioned image and put your content in a z-index above it.
>>>
>>> On Jun 26, 2013, at 9:35 AM, Ken Anderson <email@hidden> wrote:
>>>
>>>> Well, Apple Mail does, and so do the other clients I've tested.
>>>>
>>>> Any idea why my resources are so screwy?
>>>>
>>>>
>>>> On Jun 26, 2013, at 3:34 PM, Johnny Miller <email@hidden> wrote:
>>>>
>>>>> Hi Ken,
>>>>>
>>>>> I believe most mail clients don't support CSS background images.
>>>>>
>>>>> Aloha,
>>>>> Mr. Johnny Miller
>>>>> Web Development Manager
>>>>> Kahalawai Media Company
>>>>> Lahaina, HI 96761
>>>>> tel: (808) 661-7962 | mobile: (808) 283-0791
>>>>> website | e-mail
>>>>>
>>>>> On Jun 26, 2013, at 9:32 AM, Ken Anderson <email@hidden> wrote:
>>>>>
>>>>>> OK - still driving me crazy.
>>>>>>
>>>>>> If I ask WOResourceManager for the url, I get this:
>>>>>>
>>>>>> /WebObjects/FitnotixService.woa/WebServerResources/emailBackground.png
>>>>>>
>>>>>> but that path doesn't work. If I put the machine in front:
>>>>>>
>>>>>> http://127.0.0.1/WebObjects/FitnotixService.woa/WebServerResources/emailBackground.png
>>>>>>
>>>>>> still wrong. I need to add Contents after the woa:
>>>>>>
>>>>>> http://127.0.0.1/WebObjects/FitnotixService.woa/Contents/WebServerResources/emailBackground.png
>>>>>>
>>>>>> THAT URL works.
>>>>>>
>>>>>> So, do I have something configured wrong somewhere?
>>>>>>
>>>>>> If I put the image in a WOImage, I get this ing src:
>>>>>>
>>>>>> <img src="/fit/-6666/wr/wodata=/Users/kanderson/MBM/repository/trunk/source/WebObjects/FitnotixService/WebServerResources/emailBackground.png" width="800" height="600" />
>>>>>>
>>>>>> I can only assume this happens on a local machine, even though I have direct connect turned OFF and I'm definitely running everything through Apache.
>>>>>>
>>>>>> Ken
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Jun 26, 2013, at 11:57 AM, email@hidden wrote:
>>>>>>
>>>>>>> Or how to do it with WO, which I wrote from one of your emails :-)
>>>>>>>
>>>>>>> http://wiki.wocommunity.org/display/WOCOM/Emails
>>>>>>>
>>>>>>> Problem:
>>>>>>> Your HTML email have images that you want to display inline.
>>>>>>>
>>>>>>> Solution:
>>>>>>> If you have a WebObjects Component and you want to send inline images with the component, you have to make use of a trick, that was mentioned in Fabian Peters mail on the Wonder Discussion mailinglist on 6 june 2009.
>>>>>>>
>>>>>>> First of all, in the Component HTML one includes something like this:
>>>>>>> <img src="cid:image0" alt="Logo" />
>>>>>>>
>>>>>>> The code that accompanies this cid:image0 is:
>>>>>>> URL logoURL = myApp().resourceManager().pathURLForResourceNamed("logo.png", null, null);
>>>>>>> File logo = new File(logoURL.toURI());
>>>>>>> ERMailAttachment imageLogo = new ERMailFileAttachment("logo.png","<image0>",logo);
>>>>>>>
>>>>>>> Note that the file "logo.png" has to be included in the Resources folder of you WebObjects project.
>>>>>>> The "cid:image0" is linked to the <image0> in the ImageAttachment.
>>>>>>>
>>>>>>>> Or if you want to include the image in the mail, you'll have to reference it by CID: <img src="cid:image0" width="274" height="61" alt="Logo" />
>>>>>>>> See <http://stackoverflow.com/questions/4312687/how-to-embed-images-in-email>
>>>>>>>> I've never used this for CSS background images though.
>>>>>>>> Fabian
>>>>>>>> Am 26.06.2013 um 17:32 schrieb James Cicenia:
>>>>>>>>> The image has to be public. So you could just store a url to the public image.
>>>>>>>>> Otherwise:
>>>>>>>>>> /Users/kanderson/MBM/repository/trunk/source/WebObjects/FitnotixService/WebServerResources/emailBackground.png
>>>>>>>>> does look correct. It is the actual path to the image which the server needs to server it up.
>>>>>>>>> On Jun 26, 2013, at 10:06 AM, Ken Anderson <email@hidden> wrote:
>>>>>>>>>> Gang,
>>>>>>>>>> This is driving me nuts so hopefully someone has an easy answer.
>>>>>>>>>> In a component I'm using with ERMailDeliveryHTML I want to grab a background image for the email:
>>>>>>>>>> body
>>>>>>>>>> {
>>>>>>>>>> background-image:url(<webobject name="BackgroundURL"/>);
>>>>>>>>>> background-color:#ffffff;
>>>>>>>>>> }
>>>>>>>>>> BackgroundURL : WOString {
>>>>>>>>>> value = backgroundURL;
>>>>>>>>>> }
>>>>>>>>>> public String backgroundURL() {
>>>>>>>>>> return WOApplication.application().resourceManager().urlForResourceNamed("emailBackground.png", null, null, null);
>>>>>>>>>> }
>>>>>>>>>> I've tried everything including using a method to build the URL by asking WOResourceManager for the URL for the resource.
>>>>>>>>>> If I put the image in a WOImage to try and steal the URL, this is what I get:
>>>>>>>>>> <img src="/fit/-6666/wr/wodata=/Users/kanderson/MBM/repository/trunk/source/WebObjects/FitnotixService/WebServerResources/emailBackground.png" width="800" height="600" />
>>>>>>>>>> even though I'm not using direct connect, which is confusing to me.
>>>>>>>>>> Is this just because I want to make this work in Development?
>>>>>>>>>> Thanks for any thoughts! It was great to see many of you this past weekend and I hope to see you next year!
>>>>>>>>>> Ken
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>>>> This email sent to email@hidden
>>>>>>>>> _______________________________________________
>>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>>> This email sent to email@hidden
>>>>>>>> _______________________________________________
>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>> This email sent to email@hidden
>>>>>>> _______________________________________________
>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>
>>>>>>> This email sent to email@hidden
>>>>>>
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>
>>>>>> This email sent to email@hidden
>>>>>
>>>>
>>>
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden