★ wanayoo — archive 1999 http://www.php.net/manual/function.imagecreatefromjpeg.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Graphics
Quick Reference
German version of this pageJapanese version of this pageItalian version of this pageHungarian version of this page
Graphics
* GetImageSize
* ImageArc
* ImageChar
* ImageCharUp
* ImageColorAllocate
* ImageColorDeAllocate
* ImageColorAt
* ImageColorClosest
* ImageColorExact
* ImageColorResolve
* ImageGammaCorrect
* ImageColorSet
* ImageColorsForIndex
* ImageColorsTotal
* ImageColorTransparent
* ImageCopy
* ImageCopyResized
* ImageCreate
* ImageCreateFromGIF
* ImageCreateFromJPEG
* ImageCreateFromPNG
* ImageDashedLine
* ImageDestroy
* ImageFill
* ImageFilledPolygon
* ImageFilledRectangle
* ImageFillToBorder
* ImageFontHeight
* ImageFontWidth
* ImageGIF
* ImagePNG
* ImageJPEG
* ImageInterlace
* ImageLine
* ImageLoadFont
* ImagePolygon
* ImagePSBBox
* ImagePSEncodeFont
* ImagePSFreeFont
* ImagePSLoadFont
* ImagePsExtendFont
* ImagePsSlantFont
* ImagePSText
* ImageRectangle
* ImageSetPixel
* ImageString
* ImageStringUp
* ImageSX
* ImageSY
* ImageTTFBBox
* ImageTTFText
* ImageTypes
* read_exif_data
Manual: ImageCreateFromJPEG
View the source code for this pageSearch the site



Previous page
 ImageCreateFromGIF
 Updated
Sat, 12 Aug 2000
ImageCreateFromPNG 
Next page


ImageCreateFromJPEG

(unknown)

ImageCreateFromJPEG -- Create a new image from file or URL

Description

int imagecreatefromjpeg (string filename)

ImageCreateFromJPEG() returns an image identifier representing the image obtained from the given filename.

ImagecreateFromJPEG() returns an empty string on failure. It also outputs an error message, which unfortunately displays as a broken link in a browser. To ease debugging the following example will produce an error JPEG:

Example 1. Example to handle an error during creation (courtesy vic@zymsys.com )


function LoadJpeg ($imgname) {
    $im = @ImageCreateFromJPEG ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
        $im = ImageCreate (150, 30); /* Create a blank image */
        $bgc = ImageColorAllocate ($im, 255, 255, 255);
        $tc  = ImageColorAllocate ($im, 0, 0, 0);
        ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
        /* Output an errmsg */
        ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); 
    }
    return $im;
}
      


User Contributed Notes: ImageCreateFromJPEG


jeff@zaius.org
04-Jul-2000 11:38
After spending many, many hours trying to make this work, I realized that it is not supported until version 3.0.16. So, if you're having problems, check to see what version of PHP you have. You must also have version 1.8 or higher of gd, which means that you cannot have gif and jpeg support in the same installation of PHP (easily).


cveld@bigfoot.com
09-Jul-2000 10:42
Can someone tell me how I can create an image from a string with a jpeg-stream in it?



burdav@cs.felk.cvut.cz
16-Jul-2000 04:04
Hi!
can anyone tell me where can I find some help about how to make gd-1.8.3 and php4 to work together? I have debian linux potato and I have install apache-1.3 and php4 from .deb packages but there is only gd-1.7 and I need ImageCreateFromJpeg()... thax



rodders_plonker@yahoo.com
21-Jul-2000 08:49
To all those having trouble with a message to the effect of:

CreateImageFromJpeg() not supported in this PHP build

Start by adding --with-jpeg-dir to your ./configure options as I left this out (not knowing I needed it) and I spent the best part of 6 hours trying to compile to get this option. (RH 6.2, PHP 4.0.1pl2, Apache 1.3.12, GD 1.8.3)



toddb@apptechsys.com
15-Aug-2000 02:01
Can anyone tell me how to make this work with windows? I'm fine on a BSD box, but it isn't supported with my windows distribution.


 About Notes


Previous page
 ImageCreateFromGIF
 Updated
Sat, 12 Aug 2000
ImageCreateFromPNG 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.