Jump to content

Search the Community

Showing results for tags 'gd'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 7 results

  1. Hoping someone can help me with a problem I having with drawing a line graph with gd php mysql Am trying to draw a simple line graph getting data from a MySQL database. attached is the code:- I just get lots of rubbish characters on the screen. If I echo the contents of the fetched data it is correct and if I echo the $x2 and $y2 the data looks fine. Am at a loss! Any ideas would be appreciated. This is the page: www.inshome.net.au/test.php graph.php
  2. I have a black and white image dividing a city into zip codes. So a bunch of shapes and that's it. I load it (imagecreatefrompng) and I'm filling the zipcodes with color based on coordinates of a spot in the zipcode and a color relevant to information about it. If I use imagefill (or imagefilltoborder) to fill a zip code it works great. But - I also need to apply text and lines to that image on top of those filled shapes. My problem is it's always doing the fill last no matter what order I put it in the code - so anywhere a line crosses a zipcode it only gets half filled in. For example I attached an image - if i turn off the lines the white box is filled in with a shade of red. Not a great example since I think the line is right on top of the coordinate of the fill but it does it all over the image. What am I missing? Is there not a way to choose the order your draw to the image object? Is there a way to apply a change before doign the next one short of writing and reloading the file?
  3. I have created an image using the GD Library use Ajax to change parts of the image. For some reason it just wont print. When I print the image it is only printing the layer of the image that is hard coded. I can save the image then print it but other than that it wont work, it only prints the hard coded layers and not the data pulled out of variables. http://www.driftek.com/customersites/welspun/beta/createabed.php If you go to the link above and make a few layer changes and try to print the image you will see the issue. Any help is appreciated.
  4. Even though I literally copied and pasted the code below directly from the php.net manual on gd and image functions, I'm getting a syntax error message "unexpected t_variable" when I try to run the code. The culprit, according to the error message, is line 6 here: $gd = imagecreatetruecolor($x, $y); But there are NOT any missing semicolons or brackets in that line or before it. So why won't this code run for me? Here's the entire code: <?php $x = 200; $y = 200; $gd = imagecreatetruecolor($x, $y); $corners[0] = array('x' => 100, 'y' => 10); $corners[1] = array('x' => 0, 'y' => 190); $corners[2] = array('x' => 200, 'y' => 190); $red = imagecolorallocate($gd, 255, 0, 0); for ($i = 0; $i < 100000; $i++) { imagesetpixel($gd, round($x),round($y), $red); $a = rand(0, 2); $x = ($x + $corners[$a]['x']) / 2; $y = ($y + $corners[$a]['y']) / 2; } header('Content-Type: image/png'); imagepng($gd); ?> Here is a link to that page (scroll down a tiny bit) if it helps: http://www.php.net/manual/en/function.imagesetpixel.php BTW, my server is gd enabled. Maybe that version is too new? Somewhere in the back of my mind I remember that a newer version might exclude some functionality? I don't know...
  5. Spent the day trying to figure out why GD library 2.0 imagejpeg($resource_id,NULL,$quality); wouldn't output my images to the browser after updating PHP from 5.3 to 5.4. Allow me to hopefully save you the trouble. If you've enabled GD library and using an external script to generate image files, NO OTHER OUTPUT from the external script is permitted, except the header('Content-Type: image/jpeg'); and the image stream. This goes for any sub include scripts (like a database connection). Error reporting for the executable script should be set to 0 with error_reporting(0); OR you should absolutely make sure none of the scripts are generating any errors or any other output. Here some code: initial_script.php <!DOCTYPE html> <html lang="en"> <head><title>First in stack</title> <meta charset="UTF-8" /> </head> <body> <img src="<?php print createimage.php?imgid=$img_id&uid=$user_id; ?>" alt="red dot" > </body> </html> Next create the image createimage.php <?php include dbconnection.php; //assume db connection and data pull returns image name $image = $row['img_name']; //image create resources etc.. $file="/path/to/".$image; $file_resid = imagecreatefromjpeg($file); // first send the header header('Content-Type: image/jpeg'); // display the image to the browser $quality=100; imagejpeg( $file_resid, NULL, $quality) or die("error displaying jpg"); imagedestroy($image_t); ?> In my case dbconnection.php was spawning a low level notice which was being sent before the header and image stream. This was causing the process to return a broken image icon. Also, imagejpeg now requires NULL if you are displaying the image to the browser. Before (5.3) this parameter could be " ". Firebug was throwing this error - Image corrupt or truncated:
  6. Hi Guys Adding text to an image is relatively easy but I need to add text to a number of images on the same page. Is the only way to add the text and save so that I can reload when I need to. The problem arises because there are a number of images (within link tags) which have descriptive text available and a number which don't. I need to add the text "Text available" to those that do. It's driving me mad. I have tried calling a piece of php code as the src parameter of the image tag but this just locks up. Any help or pointers would be gratefully received.
  7. Well, I have an image ans I want to write a text on it. The issue is, it is saying, image cannot be displayed because it contains errors. Refer to the screenshot below as attachment. Here the codes: <img src="images/img.jpg" width="500" height="300"> <?php header ("Content-type: image/jpeg"); $string = "This is my text"; $font = 4; $width = imagefontwidth($font) * strlen($string) ; $height = imagefontheight($font) ; $im = imagecreatefromjpeg("images/img.jpg"); $x = imagesx($im) - $width ; $y = imagesy($im) - $height; $backgroundColor = imagecolorallocate ($im, 255, 255, 255); $textColor = imagecolorallocate ($im, 0, 0,0); imagestring ($im, $font, $x, $y, $string, $textColor); imagejpeg($im); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.