Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> dynamiczne generowanie obrazków w php
laplasjan
post 26.01.2009, 20:00:28
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 26.01.2009

Ostrzeżenie: (0%)
-----


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`�
Go to the top of the page
+Quote Post
shark121
post 26.01.2009, 20:24:21
Post #2





Grupa: Zarejestrowani
Postów: 62
Pomógł: 5
Dołączył: 31.03.2008

Ostrzeżenie: (0%)
-----


  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. ?>


Ten post edytował shark121 26.01.2009, 20:25:23
Go to the top of the page
+Quote Post
laplasjan
post 26.01.2009, 21:42:10
Post #3





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 26.01.2009

Ostrzeżenie: (0%)
-----


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`�
Go to the top of the page
+Quote Post
shark121
post 26.01.2009, 23:04:03
Post #4





Grupa: Zarejestrowani
Postów: 62
Pomógł: 5
Dołączył: 31.03.2008

Ostrzeżenie: (0%)
-----


  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. ?>
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 23.07.2025 - 02:11