[isJPEG]

Description

Link: [isJPEG]
Author: Kyle Jessup
Category: Image
Version: 8.x
License: Public Domain
Posted: Jul. 27, 2006
Updated: Jan. 01, 0001
More by this author...
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.

Parameters

-path string, required The path to the potential 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.
1
2
3
4
5
6
define_tag('isJPEG', -required='path');
	protect;
		return: file(#path)->setPosition(7) & read(4) == 'JFIF';
	/protect;
	return:false;
/define_tag;

 

Comments

none

Email:


Password:



Newest

Most Popular