PHP-GTK
Monday, September 15, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGdkPixbuf Constructor
GdkPixbuf Constructornext

Last updated: Sun, 12 May 2013
view this page in English

GdkPixbuf Constructor

GdkPixbuf::new_from_file (string filename);

This constructor creates a GdkPixbuf object filled with the image information available in filename. If an error occurs (e.g. file doesn't exist), an exceptionof type PhpGtkGErrorException is thrown.

Gdk supports loading a number of image formats, including .jpg, .png and .gif. On Windows, you need a dll for each file type in the pixbufloaders/ folder of your Gtk installation, e.g. libpixbufloader-png.dll or libpixbufloader-jpeg.dll.

Example 4. Loading an image file and catching errors

<?php
//Examle: Loading an image file
try {
    $pixbuf = GdkPixbuf::new_from_file('test.png');
} catch (Exception $e) {
    //Here we catch errors that could occur
    echo "An error occured:\n";
    echo $e->getMessage() . "\n";
}
?>

User Contributed Notes
gdk.gdkpixbuf.constructor.new_from_file.php
add a note about notes
There are no user contributed notes for this page.


previousGdkPixbuf Constructor
GdkPixbuf Constructornext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:50:55 2013 CEST