Created
November 20, 2013 20:02
-
-
Save ts/7570033 to your computer and use it in GitHub Desktop.
Copy <img /> tag with dimensnions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set this_file to choose file without invisibles | |
| try | |
| tell application "Image Events" | |
| -- start the Image Events application | |
| launch | |
| -- open the image file | |
| set this_image to open this_file | |
| -- get dimensions of the image | |
| copy dimensions of this_image to {W, H} | |
| set file_name to name of this_image | |
| -- purge the open image data | |
| close this_image | |
| end tell | |
| set the clipboard to "<img src=\"" & file_name & "\" width=\"" & W & "\" height=\"" & H & "\" />" | |
| on error error_message | |
| display dialog error_message | |
| end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment