{"id":733,"date":"2004-07-31T09:27:13","date_gmt":"2004-07-31T09:27:13","guid":{"rendered":"http:\/\/beta.robertprice.co.uk\/robblog\/2004\/07\/supporting_moblogging_from_the_nokia_7610-shtml\/"},"modified":"2004-07-31T09:27:13","modified_gmt":"2004-07-31T09:27:13","slug":"supporting_moblogging_from_the_nokia_7610-shtml","status":"publish","type":"post","link":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/","title":{"rendered":"Supporting Moblogging From The Nokia 7610"},"content":{"rendered":"<p>\nI&#8217;ve had to make some changes to my homebrew <acronym title=\"Multimedia Messaging Services\">MMS<\/acronym> moblog software now I have a Nokia 7610 phone.\n<\/p>\n<p>\nThe 7610 has a megapixel camera in it, which is far better than the very low res on in my old Nokia 7250.\n<\/p>\n<p>\nThe downside is I can&#8217;t use the images it creates directly in my blog as they are far to high resolution. What I needed to do was to reduce the size of the image coming in before posting it to the blog. I achieved this using the <a href=\"http:\/\/search.cpan.org\/search?module=Image::Magick\">Image::Magick<\/a> <a href=\"http:\/\/www.perl.com\/\">Perl<\/a> module.\n<\/p>\n<p>\nThis snippet of code takes an image from a filename, resizes it to a maximum of 450 wide  and 350 high, and saves it back out with the original filename.\n<\/p>\n<div class=\"code\"><code>my $oldimage = new Image::Magick;<br \/>\n$oldimage-&gt;Read($full_filename);<br \/>\n$oldimage-&gt;Scale(geometry=>'450x350&gt;');<br \/>\n$oldimage-&gt;Write(filename=&gt;$full_filename);<br \/>\n<\/code><\/div>\n<p>\nThe key to code is the use of <code>geometry<\/code>. Here I am saying what I would like the maximum boundries to be. Image::Magick does the rest, keeping the aspect ratio of the original image. The <code>&gt;<\/code> at the end tells Image::Magick only to scale if the image is larger than that ratio, meaning smaller images are left untouched.\n<\/p>\n<p>\nGreat, so I have lovely scaled images. The next problem was that the software wasn&#8217;t picking up the attachment.\n<\/p>\n<p>\nThe Nokia 7250 attaches the image directly with the <acronym title=\"Multipurpose Internet Mail Extensions\">MIME<\/acronym> type of <code>image\/jpeg<\/code>, however the Nokia 7610 attaches it with the MIME type of <code>application\/octet stream<\/code>. This means it&#8217;s hard to detect what the attachment is, however we are provided with a clue. We are given the recommended filename of the attachment, so scanning to see if it ends in .jpg lets us know if we have a JPEG image or not.\n<\/p>\n<p>\nThe code I use to detect the attachment in the octet-stream and put it into the variable <code>$attachment<\/code>looks something like this&#8230;\n<\/p>\n<div class=\"code\"><code>if ($entity-&gt;mime_type =~ m\/application\/octet-stream\/i) {<br \/>\nif (($head-&gt;recommended_filename =~ \/.jpg$\/i) || ($head-&gt;mime_attr(\"content-type.name\") =~ \/.jpg\/i)) {<br \/>\nmy $bh = $entity-&gt;bodyhandle;<br \/>\nmy $attachment = $bh-&gt;as_string;<br \/>\n<\/code><\/div>\n<p>\nWhere <code>$entity<\/code> is a <a href=\"http:\/\/search.cpan.org\/search?module=MIME::Entity\">MIME::Entity<\/a> object and <code>$head<\/code> is a <a href=\"http:\/\/search.cpan.org\/search?module=MIME::Head\">MIME::Head<\/a> object from the entity.\n<\/p>\n<p>\nI now have a tool that can take MMS email messages from various phones and post remotely to my blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve had to make some changes to my homebrew MMS moblog software now I have a Nokia 7610 phone. The 7610 has a megapixel camera in it, which is far better than the very low res on in my old Nokia 7250. The downside is I can&#8217;t use the images it creates directly in my &hellip; <a href=\"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Supporting Moblogging From The Nokia 7610&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-733","post","type-post","status-publish","format-standard","hentry","category-dev"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Supporting Moblogging From The Nokia 7610 - Robert Price<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Supporting Moblogging From The Nokia 7610 - Robert Price\" \/>\n<meta property=\"og:description\" content=\"I&#8217;ve had to make some changes to my homebrew MMS moblog software now I have a Nokia 7610 phone. The 7610 has a megapixel camera in it, which is far better than the very low res on in my old Nokia 7250. The downside is I can&#8217;t use the images it creates directly in my &hellip; Continue reading &quot;Supporting Moblogging From The Nokia 7610&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/\" \/>\n<meta property=\"og:site_name\" content=\"Robert Price\" \/>\n<meta property=\"article:published_time\" content=\"2004-07-31T09:27:13+00:00\" \/>\n<meta name=\"author\" content=\"rob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/supporting_moblogging_from_the_nokia_7610-shtml\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/supporting_moblogging_from_the_nokia_7610-shtml\\\/\"},\"author\":{\"name\":\"rob\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"headline\":\"Supporting Moblogging From The Nokia 7610\",\"datePublished\":\"2004-07-31T09:27:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/supporting_moblogging_from_the_nokia_7610-shtml\\\/\"},\"wordCount\":327,\"articleSection\":[\"Dev\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/supporting_moblogging_from_the_nokia_7610-shtml\\\/\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/supporting_moblogging_from_the_nokia_7610-shtml\\\/\",\"name\":\"Supporting Moblogging From The Nokia 7610 - Robert Price\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\"},\"datePublished\":\"2004-07-31T09:27:13+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/supporting_moblogging_from_the_nokia_7610-shtml\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/supporting_moblogging_from_the_nokia_7610-shtml\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/supporting_moblogging_from_the_nokia_7610-shtml\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Supporting Moblogging From The Nokia 7610\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\",\"name\":\"Robert Price\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\",\"name\":\"rob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"caption\":\"rob\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Supporting Moblogging From The Nokia 7610 - Robert Price","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/","og_locale":"en_GB","og_type":"article","og_title":"Supporting Moblogging From The Nokia 7610 - Robert Price","og_description":"I&#8217;ve had to make some changes to my homebrew MMS moblog software now I have a Nokia 7610 phone. The 7610 has a megapixel camera in it, which is far better than the very low res on in my old Nokia 7250. The downside is I can&#8217;t use the images it creates directly in my &hellip; Continue reading \"Supporting Moblogging From The Nokia 7610\"","og_url":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/","og_site_name":"Robert Price","article_published_time":"2004-07-31T09:27:13+00:00","author":"rob","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rob","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/#article","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/"},"author":{"name":"rob","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"headline":"Supporting Moblogging From The Nokia 7610","datePublished":"2004-07-31T09:27:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/"},"wordCount":327,"articleSection":["Dev"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/","url":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/","name":"Supporting Moblogging From The Nokia 7610 - Robert Price","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website"},"datePublished":"2004-07-31T09:27:13+00:00","author":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"breadcrumb":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.robertprice.co.uk\/robblog\/supporting_moblogging_from_the_nokia_7610-shtml\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robertprice.co.uk\/robblog\/"},{"@type":"ListItem","position":2,"name":"Supporting Moblogging From The Nokia 7610"}]},{"@type":"WebSite","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website","url":"https:\/\/www.robertprice.co.uk\/robblog\/","name":"Robert Price","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robertprice.co.uk\/robblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5","name":"rob","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","caption":"rob"}}]}},"_links":{"self":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/comments?post=733"}],"version-history":[{"count":0,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/733\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/media?parent=733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/categories?post=733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/tags?post=733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}