Webmail
Director web
::
Tutoriale
::
Code archive
::
Upload
::
Forum
::
Acasã
|
Ajutor
|
Cãutare
|
Autentificare
|
Înregistrare
» Utilizator
» Parteneri
» Linux Server
» WorldIT.info
» Web hosting
» Gazduire web
» IPFind
» Invatam.net
» PC Troubleshooting
» RegEx
» sigur.info
» Computericã
» De citit
» LAMP in CentOS
» LAMP in Ubuntu Server
» FAMP/LAMP in FreeBSD
» Formular de contact
» Optimizare Apache
» Optimizare MySQL
» Recomandari
» Hazardous Gaming
» What I Know
» PHP Funk
» Taskuri securitate
» Anti spam
» O parola eficienta
» Trojan, backdoor, spyware
» Phishing si pharming
» Securizare windows
» Cum functioneaza un virus?
» Certificate SSL
» Gumblar
» Un firewall eficient
» Ingineria sociala
» Statistici
65486
de mesaje.
7732
de topicuri.
1231
de utilizatori.
Kopotosa
e ultimul utilizator inregistrat.
[Detalii]
SkullBox Forum
|
Development
|
Web Development
| Topic:
Problema simbol copyright in php
|
|
Pagini: [
1
]
Print
Problema simbol copyright in php [693 afisari]
AnaKonD
Mesaje: 523
Offline
Problema simbol copyright in php
Vreau sa scriu simbolul de la copyright pe o imagine in php si nu reusesc
. Am construit string-ul in felul urmator:
Code:
$text = '©' . $autor . ' , ' . $data . ' , ' . 'All rights reserved. ';
si dupa cum ati ghicit, pe imagine imi apare
©
in loc de renumitul ©. Am incercat in mai multe feluri dar nu am facut nici un progres. Any ideas?
Logged
"Sa nu te opresti niciodata din a-ti pune intrebari, curiozitatea sta la baza existentei."(Albert Einstein)
cross the line
17-06-2009, 08:16
Twitt
::
Agkelos
Mesaje: 7196
Offline
Re: Problema simbol copyright in php
Incearca cu copy/paste la ©, nu cu codul HTML. O sa-ti mearga daca pagina e UTF-8.
Logged
»
Ce putem face cu sed?
»
Cache pentru imagini si texte
»
Formular de contact
17-06-2009, 08:19
Twitt
::
AnaKonD
Mesaje: 523
Offline
Re: Problema simbol copyright in php
Am incercat dar imi apare un "Š".
Logged
"Sa nu te opresti niciodata din a-ti pune intrebari, curiozitatea sta la baza existentei."(Albert Einstein)
cross the line
17-06-2009, 09:02
Twitt
::
Agkelos
Mesaje: 7196
Offline
Re: Problema simbol copyright in php
Posteaza aici bucata de cod care face treaba sa ma uit putin.
Logged
»
Ce putem face cu sed?
»
Cache pentru imagini si texte
»
Formular de contact
17-06-2009, 09:06
Twitt
::
emi
Mesaje:
Re: Problema simbol copyright in php
La mine am testat si afiseaza corect (codul php).
Daca pui o pagina html de test:
Code:
<html>
<body>
© x, 2009 , All rights reserved.
</body>
</html>
merge ?
Logged
17-06-2009, 09:07
Twitt
::
Smash
Mesaje: 1173
Offline
Re: Problema simbol copyright in php
^ el vrea sa scrie textul pe o imagine nu in browser
Logged
17-06-2009, 09:14
Twitt
::
Muzet
Mesaje: 268
Offline
Re: Problema simbol copyright in php
Foloseste:
Code:
html_entity_decode("©", ENT_COMPAT, "UTF-8")
Logged
17-06-2009, 09:24
Twitt
::
emi
Mesaje:
Re: Problema simbol copyright in php
Am testat si ce recomanda astia
aici
:
echo '©';
echo '©';
merge.
Logged
17-06-2009, 09:28
Twitt
::
AnaKonD
Mesaje: 523
Offline
Re: Problema simbol copyright in php
Nu a mers cu nici o varianta. Uitati aici codul complet:
Code:
<?php
$anul_aparitiei = 2009;
$autor = 'Xulescu';
//se preiau informatiile necesare
$anul_curent = date( 'Y' );
if( $anul_curent > $anul_aparitiei )
{
$data = $anul_aparitiei . ' - ' . $anul_curent;
}
else
{
$data = $anul_aparitiei;
}
//construim fraza
$text = '©' . $autor . ' , ' . $data . ' , ' . 'All rights reserved. ';
//construim imaginea
$imagine = imagecreatefromjpeg( 'imagini/background_footer.jpg' );
$culoare_text = imagecolorallocate( $imagine, 32, 39, 77);
//scriem textul pe imagine
imagestring( $imagine, 3, 380 , 25 , $text, $culoare_text);
//salvam pe server imaginea
imagejpeg( $imagine, "imagini/footer.jpg" );
//eliberam memoria
imagedestroy( $imagine );
?>
Logged
"Sa nu te opresti niciodata din a-ti pune intrebari, curiozitatea sta la baza existentei."(Albert Einstein)
cross the line
17-06-2009, 10:09
Twitt
::
Agkelos
Mesaje: 7196
Offline
Re: Problema simbol copyright in php
Cred ca limitarea vine de la font. Incearca sa folosesti
imagettftext()
ca sa poti modifica fontul cu arial sau ceva font care stii sigur ca are simbolul respectiv.
Logged
»
Ce putem face cu sed?
»
Cache pentru imagini si texte
»
Formular de contact
17-06-2009, 10:15
Twitt
::
emi
Mesaje:
Re: Problema simbol copyright in php
Am cautat putin, poate te ajuta
http://www.php.net/imagestring
exemplul lui mustafa:
Quote
If you have any problem with CentralEurope's words, for example : ľščťžýáíéúäňôď, I am try this problem by iconv() function.
Code:
<?php
// create example image
$im = imagecreate(200, 20);
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
$text = "ľščťžýáíéúäňôď...";
//simple convert string
$string = iconv("Windows-1250", "Latin2", $text);
// write converted string at the top left
imagestring($im, 4, 0, 0, $string, $textcolor);
// output the image
header("Content-type: image/png");
imagepng($im);
?>
Logged
17-06-2009, 10:21
Twitt
::
AnaKonD
Mesaje: 523
Offline
Re: Problema simbol copyright in php
Updated code, same problem (am incercat cu arial):
Code:
<?php
$anul_aparitiei = 2009;
$autor = 'Xulescu';
//vom seta manual fontul si marimea dorita
$font = 'arial.ttf';
$marime_font = 10;
//se preiau informatiile necesare
$anul_curent = date( 'Y' );
if( $anul_curent > $anul_aparitiei )
{
$data = $anul_aparitiei . ' - ' . $anul_curent;
}
else
{
$data = $anul_aparitiei;
}
//construim fraza
$text = '©' . $autor . ' , ' . $data . ' , ' . 'All rights reserved. ';
//construim imaginea
$imagine = imagecreatefromjpeg( 'imagini/background_footer.jpg' );
$culoare_text = imagecolorallocate( $imagine, 32, 39, 77);
//scriem textul pe imagine
$x = 380;
$y = 30;
imagettftext($imagine, $marime_font, 0, $x, $y, $culoare_text, $font, $text);
//salvam pe server imaginea
imagejpeg( $imagine, "imagini/footer.jpg" );
//eliberam memoria
imagedestroy( $imagine );
?>
Am incercat si cu exemplul tau, emi, dar tot n-a functionat. Incep sa ma intreb daca nu e de la wamp server (o configurare gresita, ceva, desi n-am umblat "sub capota" deloc). Cred ca voi scrie direct "Copyright"
Logged
"Sa nu te opresti niciodata din a-ti pune intrebari, curiozitatea sta la baza existentei."(Albert Einstein)
cross the line
17-06-2009, 10:55
Twitt
::
alixandru
Mesaje: 2
Offline
Re: Problema simbol copyright in php
E simplu, tu incerci sa scrii un text (©) intr-o imagine - si asta obtii. Faptul ca un browser stie sa interpreteze acel text ca fiind o entitate HTML (simbolul copyright) nu inseamna ca limbajul PHP sau libraria care iti scrie efectiv textul in imagine ar trebui sa faca acelasi lucru.
Asadar, tu trebuie sa scrii direct caracterul copyright, nu echivalentul lui in HTML.
Foloseste functia
chr(169)
in loc de
'©'
Un exemplu:
Code:
<?php
$text = '©' . 'PHP Group' . ' , ' . date( 'Y' ) . ' , ' . 'All rights reserved. ';
$text = chr(169) . ' PHP Group' . ' , ' . date( 'Y' ) . ' , ' . 'All rights reserved. ';
// Set the content-type
header('Content-type: image/png');
// Create the image
$im = imagecreatetruecolor(500, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 499, 29, $white);
// The text to draw
// Replace path by your own font path
$font = 'arial.ttf';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
Logged
08-07-2009, 19:06
Twitt
::
AnaKonD
Mesaje: 523
Offline
Re: Problema simbol copyright in php
It works
.Merci, raman dator cu o bere
. Daca treci prin Iasi, ma anunti
.
Logged
"Sa nu te opresti niciodata din a-ti pune intrebari, curiozitatea sta la baza existentei."(Albert Einstein)
cross the line
08-07-2009, 19:50
Twitt
::
alixandru
Mesaje: 2
Offline
Re: Problema simbol copyright in php
Bun, ma bucur ca s-a rezolvat
Logged
18-07-2009, 00:19
Twitt
::
Pagini: [
1
]
Print
SkullBox Forum
|
Development
|
Web Development
| Topic:
Problema simbol copyright in php
Powered by SMF 1.1.11
|
SMF © 2006-2009, Simple Machines LLC
Loading...