Skip to content

Instantly share code, notes, and snippets.

@foo9
Last active August 29, 2015 13:57
Show Gist options
  • Save foo9/9461980 to your computer and use it in GitHub Desktop.
Save foo9/9461980 to your computer and use it in GitHub Desktop.
Get image dimensions. (use PHP)
path = ARGV[0]
if File.file?(path) and /\.(?:jpeg|jpg|gif|png|bmp)/i =~ File.extname(path)
system(%{php -r '$w = getimagesize("#{path}"); echo("width: ${w[0]}px; height: ${w[1]}px;");'})
else
puts ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment