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
https://forums.phpfreaks.com/topic/235245-images-are-shown-with-very-low-quality/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.