PHP-GTK
Monday, November 24, 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_at_size (string filename, int width, int height);

Loads the given image into the pixbuf object and scales it to the given size, respecting the aspect ratio. If an error occurs, an exception of type PhpGtkGErrorException is thrown.

Example 5. Loading and scaling an image file

<?php
//Examle: Loading an image file and scaling it to the given size
try {
    $pixbuf = GdkPixbuf::new_from_file_at_size('test.png', 320, 240);
    echo 'Size: ' . $pixbuf->get_width() . 'x' . $pixbuf->get_height() . "\n";
} 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_at_size.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