Jump to content
php.lv forumi

Image probzes....


LamerNo1

Recommended Posts

Man ir kods kursh generee atteelu... piem:

header("Content-type: image/png");
$im = @imagecreate(80, 35) or die("Problēmas izveidojoet bildi!!!");
$kraasa = imagecolorallocate($im, 0, 64, 128);
imagepng($im);
imagedestroy($im);

(tas tā baigi simple(lai mazaak te jaaraksta))

viss ir normaali ja atver tieshi bilde.php, bet ja bilde.php ieraksta kaa "img" parametra "src" veertiibu, tad paraada tikai kvadraatinju vajadziigaas bildes izmeeraa ar paziņojumu ka bilde neexistee....

Link to comment
Share on other sites

Pamēģini aizkomentēt pāris rindiņas:

#header("Content-type: image/png");
$im = @imagecreate(80, 35) or die("Problēmas izveidojoet bildi!!!");
$kraasa = imagecolorallocate($im, 0, 64, 128);
#imagepng($im);
imagedestroy($im);

un atvērt skriptu pa tiešo - varbūt serveris bļauj, ka nav pieejams GD vai kaut ko tamlīdzīgu...

Link to comment
Share on other sites

iisti nekas nesanaaca, mosh vari paraadiit kuraas vietaas?

<?php
header("Content-type: image/png");
$im = @imagecreate(80, 35) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 64, 128);
$text_color = imagecolorallocate($im, 250, 250, 250);
$blue_top = imagecolorallocate($im, 12, 73, 134);
$blue_bot = imagecolorallocate($im, 63, 111, 159);
$blue_left = imagecolorallocate($im, 25, 82, 140);
$blue_right = imagecolorallocate($im, 51, 102, 153);

$s_top =array(
0=>0, //x1
1=>0, //y1
   2=>80, //x2
   3=>0, //y2
   4=>70, //x3
   5=>10, //y3
   6=>10, //x4
   7=>10, //y4
);
$s_bot =array(
0=>10, //x1
   1=>25, //y1
   2=>70, //x2
   3=>25, //y2
   4=>80, //x3
   5=>35, //y3
   6=>0,
   7=>35,
);
$s_left =array(
0=>0,
   1=>0,
   2=>10,
   3=>10,
   4=>10,
   5=>25,
   6=>0,
   7=>35,
);
$s_right =array(
0=>80,
   1=>0,
   2=>80,
   3=>35,
   4=>70,
   5=>25,
   6=>70,
   7=>10,
);
imagestring($im, 3, 11, 11,  "123", $text_color);
imagefilledpolygon($im, $s_top, 4, $blue_top);
imagefilledpolygon($im, $s_bot, 4, $blue_bot);
imagefilledpolygon($im, $s_left, 4, $blue_left);
imagefilledpolygon($im, $s_right, 4, $blue_right);
imagepng($im);
imagedestroy($im);
?>

Link to comment
Share on other sites

Nu doma tāda:

Ja tev tas viss saglabāts failā bilde.php, tad aizkomentē tās vietas, kurās browserim tiek norādīti headeri un kurās tiek dzīti paši bildes dati. Un tad atver šo failu browserī un skaties, vai PHP nemet ārā kādu kļūdu...

<?php
#####header("Content-type: image/png");
$im = @imagecreate(80, 35) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 64, 128);
$text_color = imagecolorallocate($im, 250, 250, 250);
$blue_top = imagecolorallocate($im, 12, 73, 134);
$blue_bot = imagecolorallocate($im, 63, 111, 159);
$blue_left = imagecolorallocate($im, 25, 82, 140);
$blue_right = imagecolorallocate($im, 51, 102, 153);

$s_top =array(
0=>0, //x1
1=>0, //y1
  2=>80, //x2
  3=>0, //y2
  4=>70, //x3
  5=>10, //y3
  6=>10, //x4
  7=>10, //y4
);
$s_bot =array(
0=>10, //x1
  1=>25, //y1
  2=>70, //x2
  3=>25, //y2
  4=>80, //x3
  5=>35, //y3
  6=>0,
  7=>35,
);
$s_left =array(
0=>0,
  1=>0,
  2=>10,
  3=>10,
  4=>10,
  5=>25,
  6=>0,
  7=>35,
);
$s_right =array(
0=>80,
  1=>0,
  2=>80,
  3=>35,
  4=>70,
  5=>25,
  6=>70,
  7=>10,
);
imagestring($im, 3, 11, 11,  "123", $text_color);
imagefilledpolygon($im, $s_top, 4, $blue_top);
imagefilledpolygon($im, $s_bot, 4, $blue_bot);
imagefilledpolygon($im, $s_left, 4, $blue_left);
imagefilledpolygon($im, $s_right, 4, $blue_right);
#####imagepng($im);
imagedestroy($im);
?>

Link to comment
Share on other sites

×
×
  • Create New...