473,396 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem with png image

TheMadMidget
I had no problem with this code on my school's server, but when I moved it to mine it didn't work at all. Before it would make an image and display the text where I wanted it to, but now if Firefox all it does it display the full URL of the php file and IE displays a lil blank image box. I'm not sure what version the old server had, but mine has php 5.2.1. I copied over the whole folder, it's not like I'm missing a file there, but I'm wondering if it's just my PHP configuration, other PHP functions work fine.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. header("Content-type: image/png");
  4. $string = $_GET['text'];
  5. $im    = imagecreatefrompng("MouseOver.png");
  6. $black = imagecolorallocate($im, 0, 0, 0);
  7. $white = imagecolorallocate($im, 255, 255, 255);
  8. $px    = (imagesx($im) - 10 * strlen($string)) / 2;
  9. $font = imageloadfont("Occidental.gdf");
  10. imagestring($im, $font, $px+1, 1+1, $string, $white);
  11. imagestring($im, $font, $px, 1, $string, $black);
  12. imagepng($im);
  13. imagedestroy($im);
  14.  
  15. ?> 
Mar 13 '07 #1
8 1888
quill
12
Does your php version have the gd library installed?
Mar 14 '07 #2
Does your php version have the gd library installed?
Not unless it's included in the standard full installation, how would I do that?
Mar 14 '07 #3
Atli
5,058 Expert 4TB
Find this line in your php.ini
Expand|Select|Wrap|Line Numbers
  1. ;extension=php_gd2.dll
and change it to
Expand|Select|Wrap|Line Numbers
  1. extension=php_gd2.dll
If your using apache you will have to restart it.
IIS isn't supposed to need a restart, but might.
Mar 14 '07 #4
That line wasn't there, I tried just adding it, but that didn't work. I'm using apache only and did a restart. I have no idea what's wrong.
Mar 14 '07 #5
Atli
5,058 Expert 4TB
What php version are you using?

Are you using Windows? If so did you install php with the installer?


If you did install php 5.x on windows using the installer, a .dll file will be missing from your installation.

Try downloading the zip version of the install from www.php.net and unzip it.
Find the ext folder in the unzipped folder and copy the php_gd2.dll to the ext folder in your current php directory. (C:/Program Files/PHP/ext/) by default

Then you will need to change / add the line as I showed you before and restart apache.

That should do it.
Mar 14 '07 #6
I'm using Windows, I tried using the installer, but it didn't seem to work so I left the files it made and used the zip version to include everything else. I checked my ext directory and the php_gd2.dll file is there.
Don't know if it help but you can check this out:
PHP Info
Mar 14 '07 #7
Atli
5,058 Expert 4TB
If the file is there and you have edited the php.ini it should show up.

Your phpinfo() shows the extension_dir as "./". You might have to find that in you php.ini and point it to the ext dir of your php installation.
Based on your phpinifo() file I'd guess (C:/Server/PHP/ext/)

And just be sure that you'r acctually editing the php.ini file that your phpinfo() refers to (C:\Server\PHP\php.ini). I've spent hours editing the wrong one, never understanding why it didn't work :P
Mar 14 '07 #8
extension_dir = "./ext"
That and uncommenting the
extension=php_gd2.dll

I figured it was "stock" going to work. Thank you Atli for your persistence, otherwise I probably would of tried reinstalling everything and came back to here.
Mar 15 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: CMEDIA_SOUND | last post by:
I have a peculiar problem, I have a tabpage with a label control on it. When i set a background image to the tabpage and drag the label around it has paint issues in that it is slow, granted the...
8
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set...
3
by: Pitcairnia | last post by:
The basic purpose of the site is for authenticated users to post event listings, which often include photographs. The user is faced with a page where they can insert all of the information about...
5
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
5
by: Shawn Hamzee | last post by:
Hello All, I am having a problem with Image_Graph on php 5.1.4. I installed the package and all of its dependencies through pear installer without any hitches. Then I started to add some very...
23
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine...
7
by: MasterMax1313 | last post by:
I'm trying to make a grid of picture box controls, which I do via code. Each of these boxes has a mouseclick, mousedown, mouseup, and mouseenter event. The mouseclick event is simple enough and works...
3
by: equazcion | last post by:
Hi, I have an image reference (IMG) in my page that changes depending on the value of a database field. Clicking the image triggers an Ajax call to change the database field (toggles the field...
3
by: helraizer1 | last post by:
Hey folks, yet again. if ($back == "m") //$back is a value pulled from a db; that works perfectly. { $wid = $rowing; $hei = $rowing; createthumb("660x240background2.gif", "./user/" ....
1
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.