Re: CLP - ON TOPIC! - Need PHP form email help, Please! [message #173132 is a reply to message #173104] |
Wed, 23 March 2011 18:25 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 3/23/2011 1:57 PM, Tim wrote:
> In article<imbdle$g3p$1(at)news(dot)eternal-september(dot)org>, Jerry Stuckle
> <jstucklex(at)attglobal(dot)net> wrote:
>
>> On 3/22/2011 7:11 PM, Tim wrote:
>>> In article<im9v9g$jj9$1(at)news(dot)eternal-september(dot)org>, Jerry Stuckle
>>> <jstucklex(at)attglobal(dot)net> wrote:
>>>
>>>> On 3/22/2011 12:03 AM, Tim wrote:
>>>> > In article<im93gr$8bp$1(at)news(dot)eternal-september(dot)org>, Jerry Stuckle
>>>> > <jstucklex(at)attglobal(dot)net> wrote:
>>>> >
>>>> >> On 3/21/2011 6:31 PM, Tim wrote:
>>>> >>> I have a form in which the user can upload a photo, which is then sent
>>>> >>> to me along with the other data on the form. I have formatted the data
>>>> >>> into an HTML email with the photo attached. I would like the photo
>>>> >>> embedded in a specific place on the page, but I have not found the code
>>>> >>> to do this and don't know enough about it to write the code myself.
>>>> >>>
>>>> >>> It would also be nice to be able to have the photo, once uploaded, to
>>>> >>> replace the upload button and associated text on the page in the place
>>>> >>> I want the photo to appear. Then maybe send the page as is as an HTML
>>>> >>> email?
>>>> >>>
>>>> >>> Any help would be appreciated.
>>>> >>
>>>> >> And your PHP question is?
>>>> >>
>>>> >> Sounds more like you need to learn how to format the email correctly,
>>>> >> which is an email/HTML question. Try a more appropriate newsgroup
>>>> >> (maybe alt.html - I don't know).
>>>> >
>>>> > The problem is not formatting the email, the problem is getting the php
>>>> > to take the image, whose name I can't know, and embedding it into the
>>>> > email. The php code constructs the email using my template and the data
>>>> > input by the user. Since I don't know the name of the file, and it is
>>>> > stored in a temp directory, I need the code that will place the image
>>>> > where I want it. In other words: it needs to convert the filename into
>>>> > the appropriate "<img src" html.
>>>> >
>>>> > I'm sure this seems very simple to all the code gurus, but I have found
>>>> > nothing that even comes close to this in any of the tutorials I have
>>>> > read.
>>>> >
>>>> > I have thought about saving the images to a permanent directory and
>>>> > changing the name to make the html easier, but there are several
>>>> > reasons to keep the original name and I don't want to keep the images
>>>> > on the server. So I need some php to assemble the html using unknown
>>>> > values.
>>>> >
>>>> > So far I have the image attached to the email, but not embedded. My
>>>> > attempt at embedding it resulted in the filename being displayed where
>>>> > the image should be. So it is not just a matter of html formatting.
>>>>
>>>> Well, you've got the image in the email; all you need is to get it to
>>>> work with the html. You already have the file name, etc - or you
>>>> wouldn't have been able to attack it to the email.
>>>>
>>>> So, what is the result you want? Not something nebulous such as
>>>> "convert the filename into the appropriate"<img src" html" - EXACTLY
>>>> what do you want? I.e. if I send you example.jpg, what does the
>>>> resultant raw html in your email look like?
>>>>
>>>> Once you can answer that, your PHP code is easy.
>>>
>>> OK. To be more clear, I have a form in which the user fills in some
>>> information and uploads a headshot. the email is formatted the same as
>>> the form except I want the image to appear next to the information
>>> instead of attached. The info is down the left side and the image on
>>> the right. There is more info under all of that.
>>>
>>> I used Forms to Go to create the original form handler. The id for the
>>> image is $FTGheadshot. Simply placing that into the html output section
>>> (like this: headshot : $FTGheadshot<br />) just gets me the file's name
>>> in the space for the image.
>>>
>>> Looking at the code, now that I have learned a little more about it, I
>>> am thinking that I should put this: $_FILES['headshot']['tmp_name']
>>> there instead. Would that be right? Isn't that the part that connects
>>> the actual file with the FTG assigned variable?
>>>
>>> Previously it said: $FTGheadshot = $_FILES['headshot']['name'];
>>>
>>> Am I on the right track with this?
>>
>> No, you're not, and creating an html email with embedded images is not
>> easy - but it is NOT a PHP question.
>>
>> First of all you need to figure out how to create the email in the first
>> place. Then you can worry about the PHP code needed to create it.
>>
>> Get a working page in your favorite email program first and see what the
>> source looks like. That will help you.
>>
>> Right now you're trying to create something with no idea what you're
>> creating. You can keep using trial and error methods and maybe get
>> there. Or you can do as I first suggested and find out how to create
>> the email you want first, ignoring any language considerations.
>
> I looked at an email with images both attached and embedded: the same
> images in both. The line that placed the image inline looks like this:
>
> <IMG=20
> id=3DMA2.1289279864 border=3D0=20
> =
> src=3D"cid:4EDBE5C8B2CC44F8ADDD6F853B321989@desktop619"=20
> width=3D480 height=3D604=20
> =
> DATASIZE=3D"144908">
>
> Where "cid:4EDBE5C8B2CC44F8ADDD6F853B321989@desktop619" is the Content
> ID. Obviously this is something that is compiled by the email program
> when the email is sent. Since HTML can not create itself, I need some
> code to do it.
>
> I have created the email, as I said, and it works perfectly other than
> this image issue. The source for the emails from this form look like
> this:
>
> --FTG_BOUNDRY
> Content-Type: text/html; charset="UTF-8"
> Content-Transfer-Encoding: base64
>
> PGh0bWw+CjxoZWFkPgo8dGl0bGU+PC90aXRsZT4KPC9oZWFkPgo8Ym9keT4KPHRhYmxlIHdp
> ZHRo
> PSI4MDAiIGJvcmRlcj0iMCIgY2VsbHNwYWNpbmc9IjIiIGNlbGxwYWRkaW5nPSIxMCI+PHRy
> Pgo8
> dGQgd2lkdGg9MzUwPkZpcnN0IE5hbWUgOiBUaW08YnI+PGJyIC8+Ckxhc3QgTmFtZSA6IExh
> d3Nv
> bjxiciAvPjxiciAvPgpBZGRyZXNzIDogMjM3OTUgSW93YSBSZC48YnIgLz48YnIgLz4KQ2l0
> eSA6
> IExlYmFub24KU3RhdGUgOiBNTwpaSVAgOiA2NTUzNjxiciAvPjxiciAvPgpNYWluIENvbnRh
> Y3Qg
> OiBjZWxsbnVtPGJyIC8+PGJyIC8+CkhvbWUgTnVtYmVyIDogNDE3LTUzMi04NDc4PGJyIC8+
> PGJy
> IC8+CkNlbGwgUGhvbmUgTnVtYmVyIDogNDE3LTY1MC04NDA2PGJyIC8+PGJyIC8+Cldvcmsg
> TnVt
> YmVyIDogNDE3IDUzMi04NDc4PGJyIC8+PGJyIC8+CkZheCBOdW1iZXIgOiA0MTcgNTMyLTg0
> Nzg8
> YnIgLz48YnIgLz4KRW1haWwgQWRkcmVzcyA6IGJhdHd6cmRAaG90bWFpbC5jb208YnIgLz48
> Yn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IGw8L3RkPjwvdHI+PC90YWJsZT48aHI+Cjx0YWJsZSB3aWR0aD0iODAwIiBi
> b3Jk
> ZXI9IjAiIGNlbGxzcGFjaW5nPSIyIiBjZWxscGFkZGluZz0iMTAiPjx0cj48dGQ+CldpbGxp
> bmcg
> dG8gYXBwZWFyIGluIHVuZGVyIGNsb3RoZXM/IDogCldpbGxpbmcgdG8gYXBwZWFyIHRvcGxl
> c3M/
> IDogPGJyIC8+CldpbGxpbmcgdG8gZG8gZnVsbCBmcm9udGFsIG51ZGl0eT8gOiAgb3IgClJl
> YXIg
> OiA8YnIgLz48L3RkPjwvdHI+PC90YWJsZT4KPC9ib2R5Pgo8L2h0bWw+Cg==
>
> Which doesn't help me in the slightest. There is also no Content ID
> statement in the code that creates this email.
>
> Since the best suggestion I have received amounts to "figure it out
> yourself" I guess I will just have to do without it the way I want.
> Obviously, if I could figure it out myself I wouldn't be here.
>
> So lets forget about the email. How about just generating a new web
> page with the image where I want it. Is that any easier?
None of this has ANYTHING to do with PHP. As I've told you before -
create the proper HTML to place the image where you want that. No PHP
needed at all. And it's still not a PHP question.
You need to completely forget about PHP and get the HTML (and email)
right. Then the PHP (or Perl or ASP or whatever you use to code it)
becomes simple.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|