Jump to content

Search the Community

Showing results for tags 'php5.4'.

  • 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 1 result

  1. 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:
×
×
  • 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.