0

I want to ask on how to create an image based on updated data on my site? For example like this image:

[![x][1]][1]

The details of the image is get from this url: [Pine][2].

That's the full code:

It's show an image with updated data based on that link.

Can someone show me what I have to find in google for the details like this? what type is this code?

1 Answers1

1

You should use GD library or Imagick(ImageMagick)

Example of image creation with GD

To install or enable already installed GD extension (https://stackoverflow.com/a/44720393/8579824)

<?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);
?> 

Aaron Yordanyan
  • 738
  • 7
  • 19