2016-12-24 3 views
0

Я изменю 5 до 50 100 сохраненных, но результат ничего не меняет каждый раз показывая только небольшой текст и как изменить шрифт также и $string = $user['name']; эта строка, печатая полное имя, мы хотим только имя fb graph api, пожалуйста, помогите.Как изменить шрифт и размер шрифта в Php Gd?

Мой код, как показано ниже:

$barcode1 = imagecreatefrompng($image_bg); 
      imagecopy($fullimage, $im1, 35, 74, 0, 0, 365, 317); 
      imagecopyresampled($fullimage, $barcode1, 0, 0, 0, 0, imagesx($fullimage), imagesy($fullimage), imagesx($barcode1), imagesy($barcode1)); 

$color = imagecolorallocate($fullimage, 0, 0, 0); 
$string = $user['name']; 
$fontSize = 5; 
$x = 95; 
$y = 344; 
$font = 'arial.ttf'; 

imagestring($fullimage, $fontSize, $x, $y, $string, $color); 

$imagename = date("Ymd") . uniqid() . uniqid() . uniqid() . '.jpg'; 
imagejpeg($fullimage, 'Apps/If_You_Produce/123321/' . $imagename, 100); 

$values['user_id'] = $userid; 
$values['image_name'] = $imagename; 
$db->insert($db_table_name, $values); 
+0

Вы должны рассмотреть возможность редактирования сообщения для форматирования в основном. – nyedidikeke

ответ

0

Вы не можете использовать 10,50,100 - http://php.net/manual/en/function.imagestring.php

Только 1-5 (по умолчанию)

UPDATE

Чтобы полностью быть в состоянии укажите размер шрифта, который вы, возможно, захотите использовать http://php.net/manual/en/function.imagettftext.php

Пример (с того же сайта):

<?php 
// Set the content-type 
header('Content-Type: image/png'); 

// Create the image 
$im = imagecreatetruecolor(400, 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, 399, 29, $white); 

// The text to draw 
$text = 'Testing...'; 
// 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); 
?> 
+0

Можете ли вы, пожалуйста .... Сообщите мне –

+0

У вас возникли проблемы с приведенным выше примером? –

+0

его не работает над моим кодом .... может у, пожалуйста, отредактируйте мой код выше с ним –

Смежные вопросы