Jump to content

Recommended Posts

I'm running the LAMP stack on ubuntu 10.04. trying to display dynamically generate images using GD or otherwise, even tried off the shelf software for the heck of it, that doesnt work either. All I get, whether I open my test website in IE or Firefox, local or remote, is the filename of the image instead of the desired generated image.

 

any ideas?

 

safe_mode is not on

Link to comment
https://forums.phpfreaks.com/topic/217579-php-not-able-to-render-generated-images/
Share on other sites

We cannot really help you without seeing both your HTML and your php code that produces (reproduces) the symptom.

 

Do web pages work at all?

 

It's likely you are outputting some characters (possibly the Byte Order Mark characters that your editor places at the start of a UTF-8 encoded file) thing before the content-type header and the header() is not actually working.

this is the code I'm trying, although I get the same results with other php scripts I've tried

 

this isn't specifically what I'm trying to accomplish, just some code I found online, but still it should work

 

<?

  // show the correct header for the image type
  header("Content-type: image/jpg");

  // an email address in a string
  $string = "email@example.com";

  // some variables to set
  $font  = 4;
  $width  = ImageFontWidth($font) * strlen($string);
  $height = ImageFontHeight($font);

  // lets begin by creating an image
  $im = @imagecreatetruecolor ($width,$height);

  //white background
  $background_color = imagecolorallocate ($im, 255, 255, 255);

  //black text
  $text_color = imagecolorallocate ($im, 0, 0, 0);

  // put it all together
  imagestring ($im, $font, 0, 0,  $string, $text_color);

  // and display
  imagejpeg ($im);

?>

 

and the results of that script produce nothing but one line of text that contains the url to where the page is at

http://192.168.2.2/webapp/testpage.php

 

 

 

I don't think your statement of what you did and what the result was is clear to anyone.

 

What is the file name of the code you posted? What URL are you entering into your browser? What is the result you get in the browser window? What does a 'view source' in your browser show?

What is the file name of the code you posted?

test.php

 

What URL are you entering into your browser?

192.168.2.2/test.php

 

What is the result you get in the browser window?

http://192.168.2.2/test.php

 

What does a 'view source' in your browser show?

nothing as the browser thinks I'm viewing an image

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.