|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Trying to get a jpg and some text on the same page - I can get the image but
as soon as I add text - either in an echo as shown below in my code or with embedded HTML inside a <html></html > it blows up. I know it's a header issue but how to get past it ? <?php $imagepath='keywest.jpg'; $image=imagecreatefromjpeg($imagepath); header('Content-Type: image/jpeg'); echo "<h5>I love using PHP!</h5>"; imagejpeg($image); ?> |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Mar 2, 6:09 pm, "barret bonden" <supp...@networks-cc.com> wrote:
> Trying to get a jpg and some text on the same page - I can get the image but > as soon as I add text - either in an echo as shown below in my code or with > embedded HTML inside a <html></html > it blows up. > I know it's a header issue but how to get past it ? > > <?php > $imagepath='keywest.jpg'; > $image=imagecreatefromjpeg($imagepath); > > header('Content-Type: image/jpeg'); > echo "<h5>I love using PHP!</h5>"; > > imagejpeg($image); > ?> What you output from PHP should be HTML if you want to include text and images - so you chould use <img src="<?php echo $filename; ?>"> or something to that effect to add images to text. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Very kind of you. Makes sense and worked.
<larry@portcommodore.com> wrote in message news:08716c2d-de34-4c8f-8264-840b159c831e@e23g2000prf.googlegroups.com... > On Mar 2, 6:09 pm, "barret bonden" <supp...@networks-cc.com> wrote: >> Trying to get a jpg and some text on the same page - I can get the image >> but >> as soon as I add text - either in an echo as shown below in my code or >> with >> embedded HTML inside a <html></html > it blows up. >> I know it's a header issue but how to get past it ? >> >> <?php >> $imagepath='keywest.jpg'; >> $image=imagecreatefromjpeg($imagepath); >> >> header('Content-Type: image/jpeg'); >> echo "<h5>I love using PHP!</h5>"; >> >> imagejpeg($image); >> ?> > > What you output from PHP should be HTML if you want to include text > and images - so you chould use > > <img src="<?php echo $filename; ?>"> > > or something to that effect to add images to text. |
|
![]() |
| Outils de la discussion | |
|
|