【问题标题】:graphics not showing on internet but fine on localhost (php)图形未在 Internet 上显示,但在 localhost (php) 上很好
【发布时间】:2014-01-26 14:09:03
【问题描述】:

我最喜欢的网站和第一次在这里写作。我已经使用 php 在图像上写了这在我的本地主机上工作正常,但它在互联网(000webhost)上不起作用我已经用谷歌搜索然后检查我的 gd 库是否打开,我还设置了所有权限,但图像仍然没有显示。

<?php
session_start();
// File and new size
$filename = 'images/solar-kid.jpg';
if(isset($_POST['sub']))
{
    $txt=$_POST['txt'];
}

// Content type
header('Content-Type:image/jpeg');

// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = 350;
$newheight = 300;

// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);

// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

$white = imagecolorallocate($thumb, 255, 255, 255);
$grey = imagecolorallocate($thumb, 128, 128, 128);
$black = imagecolorallocate($thumb, 0, 0, 0);
imagefilledrectangle($thumb, 0, 0, 399, 29, $black);
imagefilledrectangle($thumb, 0, 270, 399, 299, $black);
$white = imagecolorallocate($thumb, 255, 255, 255);
$black = imagecolorallocate($thumb, 0, 0, 0);
$text = $txt;
$font = 'times.ttf';
imagettftext($thumb, 15, 0, 10, 20, $white, $font, $text);

// Output
imagejpeg($thumb);

?>

这是它在Click here网站上显示的结果

【问题讨论】:

    标签: php graphics


    【解决方案1】:

    000webhost 免费域不支持我不知道为什么。我把它上传到另一个主机的付费服务器上,它就像一个魅力

    【讨论】:

      猜你喜欢
      • 2011-06-03
      • 2012-06-08
      • 1970-01-01
      • 2020-11-26
      • 2013-11-09
      • 2011-07-10
      • 2020-09-02
      • 2010-10-08
      • 1970-01-01
      相关资源
      最近更新 更多