<?php $file = dirname(__FILE__) . '/simpletext.wbmp'; jpeg2wbmp('', $file, 20, 120, 8); jpeg2wbmp(null, $file, 20, 120, 8); jpeg2wbmp(false, $file, 20, 120, 8); unlink(dirname(__FILE__) . '/simpletext.wbmp');
<?php // Create a blank image and add some text $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); $file = dirname(__FILE__) . '/simpletext.jpg'; // Save the image as 'simpletext.jpg' imagejpeg($im, $file); // Free up memory imagedestroy($im); jpeg2wbmp($file, '', 20, 120, 8); jpeg2wbmp($file, null, 20, 120, 8); jpeg2wbmp($file, false, 20, 120, 8);
<?php // Create a blank image and add some text $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); $file = dirname(__FILE__) . '/simpletext.jpg'; $file2 = dirname(__FILE__) . '/simpletext.wbmp'; // Save the image as 'simpletext.jpg' imagejpeg($im, $file); // Free up memory imagedestroy($im); jpeg2wbmp($file, $file2, 20, 120, 9); jpeg2wbmp($file, $file2, 20, 120, -1); error_reporting(0); unlink(dirname(__FILE__) . '/simpletext.jpg'); unlink(dirname(__FILE__) . '/simpletext.wbmp');
public function jpegToWbmp(string $jpegFile, string $wbmpFile, array $settings = NULL) : bool { if (is_file($jpegFile)) { $height = isset($settings['height']) ? $settings['height'] : 0; $width = isset($settings['width']) ? $settings['width'] : 0; $threshold = isset($settings['threshold']) ? $settings['threshold'] : 0; return jpeg2wbmp($jpegFile, $wbmpFile, $height, $width, $threshold); } else { return false; } }
public function jpegToWbmp($jpegFile = '', $wbmpFile = '', $settings = array()) { if (is_file($jpegFile) && is_string($wbmpFile)) { $height = isset($settings['height']) ? $settings['height'] : 0; $width = isset($settings['width']) ? $settings['width'] : 0; $threshold = isset($settings['threshold']) ? $settings['threshold'] : 0; return jpeg2wbmp($jpegFile, $wbmpFile, $height, $width, $threshold); } else { Error::set(lang('Error', 'fileParameter', '1.(jpegFile)')); Error::set(lang('Error', 'stringParameter', '2.(wbmpFile)')); return false; } }