Advertisement

08.23.2005 at 04:58AM PDT, ID: 21536605
[x]
Attachment Details

output image via function

Asked by sonofkyuss in PHP Scripting Language

Tags: , ,

I have some code that outputs an image...in the end it's sth like
imagejpeg($image);

Now, I DON'T want to output the image by keeping that code chunk in a separate file image.php like this
<img src="image.php">

Instead I'd like to put the code in a function let's say DrawImage($arr) and at the end have sth like
return imagejpeg($image);

I want to do this to pass arguments to the function(like an array fo instance) AND have html/php in the same page where I'm outputing.

So in the end I'd like to have sth like this:

<img src="<?= DrawImage($list); ?>">

I've tried to do this but I'm not sure how to set the content type(if that's what I'm doing wrong)...I keep getting raw byte data instead of the image.

Any thoughts?Start Free Trial
[+][-]08.23.2005 at 05:36AM PDT, ID: 14732452

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.23.2005 at 07:55AM PDT, ID: 14734109

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: php, output, image
Sign Up Now!
Solution Provided By: seemilesrun
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32