Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: dynamiczne generowanie obrazków w php
Forum PHP.pl > Forum > PHP
laplasjan
Proszę o pomoc w rozwiązaniu problemu:
czemu ten skrypt nie dział poprawnie?

Kod
<?php
var_dump(gd_info());
?>
<?php

$im = imagecreate(100, 100);

$string = 'PHP';

$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);

// prints a black "P" in the top left corner
imagechar($im, 1, 0, 0, $string, $black);

header('Content-type: image/png');
imagepng($im);

?>


EFEKT:

Kod
  array(12) {    ["GD Version"]=>    string(27) "bundled (2.0.34 compatible)"    ["FreeType Support"]=>    bool(true)    ["FreeType Linkage"]=>    string(13) "with freetype"    ["T1Lib Support"]=>    bool(false)    ["GIF Read Support"]=>    bool(true)    ["GIF Create Support"]=>    bool(true)    ["JPG Support"]=>    bool(true)    ["PNG Support"]=>    bool(true)    ["WBMP Support"]=>    bool(true)    ["XPM Support"]=>    bool(false)    ["XBM Support"]=>    bool(true)    ["JIS-mapped Japanese Font Support"]=>    bool(false)  }  
     <b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /home/unikart/ftp/unites/obrazek.php:9) in <b>/home/unikart/ftp/unites/obrazek.php</b> on line <b>24</b>
     �PNG    ���  IHDR���d���d���J,���PLTE������U��~��� IDATx�c`@Px��PU6�ፂQ0  F�(@��$��NM����IEND�B`�
shark121
  1. <?php
  2. header('Content-type: image/png');
  3.  
  4. $im = imagecreate(100, 100);
  5.  
  6. $string = 'PHP';
  7.  
  8. $bg = imagecolorallocate($im, 255, 255, 255);
  9. $black = imagecolorallocate($im, 0, 0, 0);
  10.  
  11. // prints a black \"P\" in the top left corner
  12. imagechar($im, 1, 0, 0, $string, $black);
  13.  
  14. imagepng($im);
  15. imagedestroy($im);
  16.  
  17. ?>
laplasjan
Nadal nie działa

EFEKT:
Kod
[b]Warning[/b]:  Cannot modify header information - headers already sent by (output started at /home/unikart/ftp/unites/obrazek.php:9) in [b]/home/unikart/ftp/unites/obrazek.php[/b] on line [b]10[/b]
�PNG  ��� IHDR���d���d���J,���PLTE������U��~��� IDATx�c`@Px��PU6�ፂQ0 F�(@��$��NM����IEND�B`�
shark121
  1. <?php
  2. header("Content-type: image/gif");
  3.  
  4. $obrazek = @imageCreate(75, 20)
  5.    or die("Niemożna wyświetlić obrazka");
  6. $kolor_tla = imagecolorallocate ($obrazek, 255, 255, 255 );
  7. $kolor_tekstu = imagecolorallocate($obrazek,0,0,0);
  8. $tekst = "shark";
  9. imagestring($obrazek, 10, 5, 5, $tekst, $kolor_tekstu);
  10. imagegif($obrazek);
  11. imagedestroy($obrazek);
  12. ?>
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.