Created
January 12, 2016 06:35
-
-
Save guoxiangke/2fdfeb8b20087e2cfa3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// echo phpinfo(); | |
// Set the content-type | |
// header('Content-Type: image/png'); | |
header ("Content-type: image/png"); | |
$x = 600; | |
$y = 1240; | |
// $x = 240; | |
// $y = 70; | |
$rh = 100; | |
$A = '3.jpg'; | |
$B = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQGx8DoAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL0dFZ1l6MURtdTdmQzBGT05BbWFLAAIEMUmTVgMECAcAAA%3D%3D'; | |
$im1 = imagecreatefromstring(file_get_contents($A)); | |
$im2 = imagecreatefromstring(file_get_contents($B)); | |
imagecopymerge($im1, $im2, $x, $y, 0, 0, imagesx($im2), imagesy($im2), $rh); | |
$ori = $im1; | |
imageGif($ori);return; | |
// Create the image | |
$im = imagecreatetruecolor(150, 30); | |
// Create some colors | |
$white = imagecolorallocate($im, 255, 255, 255); | |
$grey = imagecolorallocate($im, 128, 128, 128); | |
$black = imagecolorallocate($im, 238, 32, 105); | |
imagefilledrectangle($im, 0, 0, 399, 29, $white); | |
// The text to draw | |
$text = '永不止息...'; | |
// Replace path by your own font path | |
$font = '/var/www/html/mp/msyh.ttf'; | |
// Add some shadow to the text | |
// imagettftext($im, 15, 0, 11, 21, $grey, $font, $text); | |
// Add the text | |
imagettftext($im, 15, 0, 10, 20, $black, $font, $text); | |
// Using imagepng() results in clearer text compared with imagejpeg() | |
// imagepng($im); | |
// imageGif($im1,'sites/default/files/test.gif'); | |
// $x = 60; | |
// $y = 1400; | |
$x = 50; | |
$y = 800; | |
$rh = 50; | |
// $A = $im; | |
// $B = 'http://wx.qlogo.cn/mmopen/0wRpPfN90ibCJbDUmgAgric9czu1oEIaPrstRgibFDAkcpCH0S5k7TZqzh55F9z0PnntoAz5Tb1oKKoEibm8BI5ibMATviaHLNzRat/0'; | |
$im1 = $ori; | |
$im2 = $im; | |
imagecopymerge($im1, $im2, $x, $y, 0, 0, imagesx($im2), imagesy($im2), $rh); | |
imagepng($im1); | |
// imageGif($im1,'sites/default/files/test.gif'); | |
// header('location:sites/default/files/test.gif'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment