WideImage 1.0 branch (discontinued)

WideImage Wiki : SavingImages

MainPage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Support This Project SourceForge.net Logo
Important notice: the development of WideImage 1.0 branch is discontinued. Please visit http://wideimage.sourceforge.net for the new version of library and documentation.
This web site will remain accessible to serve as documentation for the old versions of the library. For help on migration, please refer to the migration guide.
Most recent edit on 2007-10-03 02:53:19 by GasperKozak

Additions:
override format:

Deletions:
override format
will save a GIF image in a .png file (usually not a good thing)
$img->saveToFile('/path/to/image.png', 'gif');




Edited on 2007-10-03 02:52:23 by GasperKozak

Additions:
$img->saveToFile('image.png', null, 0);
$img->saveToFile('image.png', null, 9, PNG_NO_FILTER);
save a quality 40 jpeg to a file without extension
$img->saveToFile('image-file-without-extension', 'jpeg', 40);
Ofcourse, similar usage applies to the wiImage::asString() method.


Deletions:
$img->saveToFile('image.png', 0);
$img->saveToFile('image.png', 9, PNG_NO_FILTER);
Ofcourse, the same usage applies to the wiImage::asString() method.




Edited on 2007-07-01 15:21:43 by GasperKozak [additional arguments description for jpeg and png]

Additions:
$Img->saveToFile('image.jpg', null, 40);

Format specifics

JPEG and PNG formats support additional parameters. JPEG supports quality and PNG supports compression level and filters. These parameters are easily passed to the methods:
quality 80 jpeg
$img->saveToFile('image.jpg', null, 80);
png without compression
$img->saveToFile('image.png', 0);
png with highest compression level but without filters (the default is PNG_ALL_FILTERS)
$img->saveToFile('image.png', 9, PNG_NO_FILTER);
Ofcourse, the same usage applies to the wiImage::asString() method.
For details on JPEG quality, see imagejpeg(), and for PNG compression and filters, see imagepng().
Note: don't be confused if you notice that the
compression level parameter of imagepng() has been incorrectly named quality in the PHP manual. PNG format has no quality the way JPEG has it (smaller file size ~= uglier image). It's a lossless image format, so no detail is lost (= the quality remains the same) regardless of the compression level.


Deletions:
$Img->saveToFile('image.jpg', null, 0);



Edited on 2007-03-03 12:47:43 by GasperKozak

Additions:
wiImage::asString($format[, additional parameters]);



Edited on 2007-03-03 12:47:13 by GasperKozak

Additions:
simple save to a png
override format
will save a GIF image in a .png file (usually not a good thing)
simple retrieve
$data = $img->asString('gif');
will retrieve a jpeg, $quality=80
$data = $img->asString('jpg', 80);


Deletions:
simple save
override format -- will save a .gif image in a .png file (usually not a good thing)




Edited on 2007-03-03 12:45:01 by GasperKozak

Additions:
WideImage supports saving images to a file and string. With string output, you can easily capture image data and write it for example to a database.

Saving to a file

Method signature:
wiImage::saveToFile($uri, $format = null[, additional arguments])
This method writes an image to a file. The format is determined from $uri extension and can be overriden with $format. Additional arguments specify values passed to a file mapper that should be used upon saving.
// simple save
$img->saveToFile('/path/to/image.png');
// override format -- will save a .gif image in a .png file (usually not a good thing)
$img->saveToFile('/path/to/image.png', 'gif');
// specify additional arguments
// save to jpeg, don't override format, $quality=40
$Img->saveToFile('image.jpg', null, 0);

Retrieving as a string





Oldest known version of this page was edited on 2007-03-03 11:35:49 by GasperKozak []
Page view:

Saving Images




CategoryDocApi
WideImage - an Object-Oriented PHP Image Library for Image manipulation
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.1892 seconds