From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Konstantin Shakhnov Newsgroups: gmane.emacs.help Subject: Re: HTML img tags Date: Wed, 14 Dec 2016 12:51:02 +0300 Message-ID: <20161214095101.GA8977@eee> References: <8xxoa0johe9.fsf@village.keycorner.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1481708635 3465 195.159.176.226 (14 Dec 2016 09:43:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Dec 2016 09:43:55 +0000 (UTC) User-Agent: Mutt/1.5.23 (2014-03-12) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 14 10:43:52 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cH66J-0000Ke-JZ for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Dec 2016 10:43:51 +0100 Original-Received: from localhost ([::1]:46442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cH66N-0004wI-AW for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Dec 2016 04:43:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cH65x-0004r5-Fw for help-gnu-emacs@gnu.org; Wed, 14 Dec 2016 04:43:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cH65t-0007or-KA for help-gnu-emacs@gnu.org; Wed, 14 Dec 2016 04:43:29 -0500 Original-Received: from smtp23.mail.ru ([94.100.181.178]:53132) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cH65t-0007oJ-6w for help-gnu-emacs@gnu.org; Wed, 14 Dec 2016 04:43:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date; bh=QK4ujaI5GNXAXfd43Br5+DbNeZ73A7LNQdNxW7PLKnA=; b=gXH1Ucutlsjhs1fHhqHpY0e+gT0AzsCIwgCuuwO+1yQmiPjz2uH2QMVq457KxRE87YK9zxGGey7pIfdZMKWvbKT3gicjwiI+lFF4nvu8hg0OnIN5IhfdJ2D2wYDPPCWErMDPdUwc45f6iaxf2/jqCAJggLrzrlXB+HyelcNF9Yc=; Original-Received: from [94.158.176.77] (port=49738 helo=eee) by smtp23.mail.ru with esmtpa (envelope-from ) id 1cH65p-0003i4-Ot for help-gnu-emacs@gnu.org; Wed, 14 Dec 2016 12:43:22 +0300 Content-Disposition: inline In-Reply-To: <8xxoa0johe9.fsf@village.keycorner.org> Authentication-Results: smtp23.mail.ru; auth=pass smtp.auth=kastian@mail.ru smtp.mailfrom=kastian@mail.ru X-E1FCDC63: 8B07640A20C3E0169BAA05210FD5C7E2E26C7FC155FDCB66 X-E1FCDC64: E2CED0578E6977575B5B5DCD024DA32AF7842406BA7F3244B5FF693873262443 X-Mailru-Sender: FD668448AC40568882DD66648ECA68625A8DB3FFBF4DCC7DF8A5C16FFD8AC4F18F4C61976F1371BEF8D9167951635F18 X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 94.100.181.178 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111951 Archived-At: On Sat, Dec 10, 2016 at 10:53:02AM -0600, Hikaru Ichijyo wrote: > Is there a mode, or some bit of Lisp code I can put in ~/.emacs, that > will let Emacs guess the width= and height= attributes of an image file > from the image itself when I create an img tag in HTML? I realize > there's probably no way for Emacs to do that without calling external > programs as a subprocess, so it's unlikely, but it would certainly be > convenient, and there are some HTML authoring programs that will do that > for you. The old KDE 3 app Quanta Plus did, but I'd rather do > everything in Emacs. If you have imagemagic this will work: (defun my-insert-html-image-tag (filename) "Insert html tag for image file" (interactive "fFile name: ") (insert (format "" filename (replace-regexp-in-string "\n" "" (shell-command-to-string (format "identify %s | sed -r 's/^.* ([0-9]+)x([0-9]+) .*/width=\\1 heght=\\2/'" filename))))))