<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic overwrite files with scripts in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/overwrite-files-with-scripts/m-p/154080#M108571</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to resize, adjust and overwrite uploaded photos.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I cannot find documentation on how to save the image back over itself. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have so far&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var newImage = document.transformImage("image/jpeg","-normalize -resize 1024x768",&amp;nbsp; document.parent);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This gives me an error about the file existing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Aug 2008 15:47:09 GMT</pubDate>
    <dc:creator>bplatt</dc:creator>
    <dc:date>2008-08-01T15:47:09Z</dc:date>
    <item>
      <title>overwrite files with scripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/overwrite-files-with-scripts/m-p/154080#M108571</link>
      <description>I need to resize, adjust and overwrite uploaded photos.&amp;nbsp; I cannot find documentation on how to save the image back over itself. I have so farvar newImage = document.transformImage("image/jpeg","-normalize -resize 1024x768",&amp;nbsp; document.parent);This gives me an error about the file existing.</description>
      <pubDate>Fri, 01 Aug 2008 15:47:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/overwrite-files-with-scripts/m-p/154080#M108571</guid>
      <dc:creator>bplatt</dc:creator>
      <dc:date>2008-08-01T15:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: overwrite files with scripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/overwrite-files-with-scripts/m-p/154081#M108572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'd suggest you rename the old image, write the new image, and then delete the renamed old image (rename old image instead of deleting in case something goes wrong and you need to retry).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Aug 2008 09:06:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/overwrite-files-with-scripts/m-p/154081#M108572</guid>
      <dc:creator>jbarmash</dc:creator>
      <dc:date>2008-08-02T09:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: overwrite files with scripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/overwrite-files-with-scripts/m-p/154082#M108573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I have gotten this far:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// "-normalize -resize 1024x768", &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var strOrigName = document.properties.name;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var tmpName = "resized_" + document.properties.name;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;document.properties.name =&amp;nbsp; tmpName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var rImage=document.transformImage("image/jpeg","-normalize -resize 1024x768",&amp;nbsp; document.parent);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (rImage){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;document.properties.name =&amp;nbsp; strOrigName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; document.save();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; //document.remove();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The documentation does not seem to give any way to access specific known docs.&amp;nbsp; So I can rename and save the new resizedimage, but cannot figure out how to delete the old file nor can I figure out how to rename the new document.&amp;nbsp; I am very familiar with javascript and maybe I am too clouded by regular web scripting to see how this works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The errors I get state nodeRef is required, but I cannot find anyway to obtain a nodeRef.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 21:26:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/overwrite-files-with-scripts/m-p/154082#M108573</guid>
      <dc:creator>bplatt</dc:creator>
      <dc:date>2008-08-04T21:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: overwrite files with scripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/overwrite-files-with-scripts/m-p/154083#M108574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just tried deleting nodes and it works, using remove() or document.removeNode.&amp;nbsp; I did get exceptions throwin in the UI, but that is because after you delete "document", it tries to come back to properties sheet, but the document no longer exists. so you need to make sure you run the script not from the document itself, but from some other place.&amp;nbsp; find the node you want using search.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Aug 2008 12:55:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/overwrite-files-with-scripts/m-p/154083#M108574</guid>
      <dc:creator>jbarmash</dc:creator>
      <dc:date>2008-08-13T12:55:34Z</dc:date>
    </item>
  </channel>
</rss>

