Jump to content

Images are shown with VERY low quality!


u214

Recommended Posts

So. I'm using this code right here:

<?php
$imagepath = "css/images/statspage.jpg";

$image = imagecreatefromjpeg($imagepath);

$imgheight = imagesy($image);

$color = imagecolorallocate($image, 255, 255, 255);

imagestring($image, 5, 70, $imgheight-50, "This is a test", $color);

header('Content-Type: image/jpeg');

imagejpeg($image);
?>

It works like it should. Now my problem is, is that the image is being displayed at a very low quality!

 

Here's the original image:                    30t48d5.jpg

 

Here's the image with the code above:image.php

 

RIGHT away you can tell the HUGE difference. I'm not sure what I'm doing wrong. Maybe i need a higher res image?

If y'all guys know a different method THAT also achieves the same thing I'm trying to do. Please let me know ASAP!

Link to comment
Share on other sites

Try using this...

<?php
$imagepath = "css/images/statspage.jpg";

$image = imagecreatefromjpeg($imagepath);

$imgheight = imagesy($image);

$color = imagecolorallocate($image, 255, 255, 255);

imagestring($image, 5, 70, $imgheight-50, "This is a test", $color);

header('Content-Type: image/jpeg');

imagejpeg($image, NULL, 100);
?>

 

Tell me how it goes.

 

Regards, PaulRyan.

Link to comment
Share on other sites

:P. Very nice. Thank you sooo much man. Works perfectly.

I guess I should get into reading more about the PHP function parameters.

 

imagejpeg - Parameters: Image, Filename, QUALITY

 

Thank you so much once again!

Link to comment
Share on other sites

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.