Lasso Soft Inc. > Home

[isJPEG]

LinkisJPEG
AuthorKyle Jessup
CategoryImage
Version8.x
LicensePublic Domain
Posted27 Jul 2006
Updated27 Jul 2006
More by this author...

Description

This tag reads the image type marker contained in every JPEG file to confirm that the file is indeed a JPEG image. This tag will confirm JPEGness regardless of the extension of the file. This tag assumes that it has permission to read the file in question. All JPEG image files contain a marker which looks like so: JFIF. This tag looks for that marker. This tag may return the wrong answer if the file contains that marker and is not an actual JPEG image file.

Sample Usage

isJPEG('/path/to/image.jpg'); // true

isJPEG('/path/to/file.txt'); // false

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define_tag('isJPEG', -required='path');
	protect;
		return: file(#path)->setPosition(7) & read(4) == 'JFIF';
	/protect;
	return:false;
/define_tag;

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft