PHP: ImageJPEG: Only 255 Colors?!?

PHP: ImageJPEG: Only 255 Colors?!?

Beitragvon SvenLittkowski » 02.12.2011, 06:33

Who can help? In order to be able using down-sozed versions of my high-resolution photos, i stored them on my server space, and use a PHP script to generate smaller versions, made for usage in forums like this.

However, the problem is that for some very strange reason I am getting not only size-reduced images, but also color-reduced images! Who can help?

Here's the PHP code I use:

[PHP] $MyWhat=$_GET['What']; // Getting parameters
$MyWidth=$_GET['Width'];

$MyOriginalImage=imagecreatefromjpeg($MyWhat); // Reading measures of original image
$MyOriginalWidth=imagesx($MyOriginalImage);
$MyOriginalHeight=imagesy($MyOriginalImage);

$MyFactor=bcdiv($MyOriginalWidth,$MyWidth,2); // Calculating new height to given new width
$MyResizedHeight=bcdiv($MyOriginalHeight,$MyFactor,0);

$MyResizedImage=imagecreate($MyWidth,$MyResizedHeight); // Producing new resized image
$farbe_body=imagecolorallocate($MyResizedImage,255,255,255 );
imagecopyresized($MyResizedImage,$MyOriginalImage,0,0,0,0,$MyWidth,$MyResizedHeight,$MyOriginalWidth,$MyOriginalHeight);
// echo imagecolorstotal($MyResizedImage);
imagejpeg($MyResizedImage);[/PHP]

And here's the URL:
URL: jamaica-focus.com/SvenLittkowski/p/ImagesDisplayRemote.php5?What=../v/Lib/Nature/ID/01/100_5322 - 72DPI - 3000x2000px.jpg&Width=1000
SvenLittkowski
neu hier
 
Beiträge: 4
Registriert: 24.11.2011, 20:40

Re: PHP: ImageJPEG: Only 255 Colors?!?

Beitragvon SvenLittkowski » 03.12.2011, 02:33

Ist hier jemand in diesem Forum?

Das Problem wurde bereits gelöst. :-)
SvenLittkowski
neu hier
 
Beiträge: 4
Registriert: 24.11.2011, 20:40


Moderatoren: Laus, Moderatoren

Ähnliche Beiträge zu "PHP: ImageJPEG: Only 255 Colors?!?"

Zurück zu: CSS für Anfänger

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 3 Gäste