Filefield module https://www.zengenuity.com/ en The Week in Drupal: February 24, 2012 https://www.zengenuity.com/blog/2012-02/week-drupal-february-24-2012 <span class="field field--name-title field--type-string field--label-hidden">The Week in Drupal: February 24, 2012</span> <div class="paragraph html"> <div class="container"> <p>A look back at interesting modules, articles and other <a href="https://drupal.org">Drupal</a> news of February 17 - 24, 2012.</p> <p><a href="https://www.flickr.com/photos/theabellsix/6521435235/" title="ice drops by wenabell, on Flickr"><img src="https://farm8.staticflickr.com/7151/6521435235_13584b86a5.jpg" alt="ice drops" width="500" height="333" /></a></p> <h2>Drupal News</h2> <p><strong><a href="https://denver2012.drupal.org/news/create-personalized-schedule-drupalcon" title="Create a Personalized Schedule for DrupalCon">Create a Personalized Schedule for DrupalCon</a></strong></p> <p><strong><a href="https://funnymonkey.com/drupal-in-education-unconference" title="Drupal in Education Unconference">Drupal in Education Unconference</a></strong> - The Monday before DrupalCon in Denver</p> <p><strong><a href="https://groups.drupal.org/node/211208" title="Drupal 8 Initiatives: Report from the Budapest sprint on Drupal 8 Multilingual Initiative issues">Drupal 8 Initiatives: Report from the Budapest sprint on Drupal 8 Multilingual Initiative issues</a></strong></p> <p><strong><a href="https://groups.drupal.org/node/210973" title="Drupal core announcements: Proposal: Loosen rules regarding patches that may be backported during a stable release (7.x+)">Drupal core announcements: Proposal: Loosen rules regarding patches that may be backported during a stable release (7.x+)</a></strong></p> <p><strong><a href="https://www.garfieldtech.com/blog/refocusing-wscci" title="Larry Garfield: Refocusing WSCCI">Larry Garfield: Refocusing WSCCI</a></strong></p> <h2>Great Posts and Tutorials</h2> <p><strong><a href="https://www.metaltoad.com/blog/using-drupal-batch-api" title="Using the Drupal Batch API">Using the Drupal Batch API</a></strong> - Also demostrates how to write your own Drush commands.</p> <p><strong><a href="https://fourkitchens.com/blog/2012/02/22/case-study-big-gains-small-changes" title="Case study: Big performance gains from small changes">Case study: Big performance gains from small changes</a></strong></p> <p><strong><a href="https://m.echodittolabs.org/blog/2012/02/introducing-backbone-module-drupal" title="Introducing the Backbone Module for Drupal">Introducing the Backbone Module for Drupal</a></strong></p> <p><strong><a href="https://www.leveltendesign.com/blog/tom/quick-enhancements-make-drupal-content-admin-dirt-simple" title="Quick Enhancements to Make Drupal Content Admin Dirt Simple">Quick Enhancements to Make Drupal Content Admin Dirt Simple</a></strong></p> <p><strong><a href="https://zufelt.ca/blog/how-send-html-mail-using-smtp-authentication-drupal" title="How to send HTML mail using SMTP authentication on Drupal">How to send HTML mail using SMTP authentication on Drupal</a></strong></p> <p><strong><a href="https://evolvingweb.ca/story/understanding-entity-api-module" title="Understanding the Entity API Module">Understanding the Entity API Module</a></strong></p> <p><strong><a href="https://rowlandsgroup.com/articles/2012/02/nick-schuch/programmatically-insert-local-files-managed-files" title="Programmatically Insert Local Files to Managed Files">Programmatically Insert Local Files to Managed Files</a></strong></p> <p><strong><a href="https://www.acquia.com/resources/podcasts/acquia-podcast-40-jennifer-hodgdon-documentation-drupal" title="Jennifer Hodgdon on Documentation for Drupal (Podcast)">Jennifer Hodgdon on Documentation for Drupal (Podcast)</a></strong></p> <p><strong><a href="https://zufelt.ca/blog/how-split-drupal-commerce-orders-checkout" title="How to split Drupal Commerce orders at checkout">How to split Drupal Commerce orders at checkout</a></strong></p> <p><strong><a href="https://flink.com.au/tips-tricks/done-60-seconds-location-based-service-example-using-ip-geolocation-3" title="A location based service example using IP Geolocation: map of buyer locations">A location based service example using IP Geolocation: map of buyer locations</a></strong></p> <h2>Interesting New Modules</h2> <p><strong><a href="https://blog.urbaninsight.com/2012/02/17/simpleads-new-advertisement-module-for-drupal-7" title="SimpleAds: A new advertisement module for Drupal 7">SimpleAds: A new advertisement module for Drupal 7</a></strong></p> <p><strong><a href="https://drupal.org/project/nested_image_style" title="Nested Image Style">Nested Image Style</a></strong> - This module enables creating image styles which inherit image effects from other image styles.</p> <p><strong><a href="https://drupal.org/sandbox/hotspoons/1450784" title="Webform Chart">Webform Chart</a></strong> - Displays webform results in a graphically using a charting library.</p> <p><strong><a href="https://drupal.org/sandbox/johnskulski/1449688" title="Path Redirect by Date">Path Redirect by Date</a></strong> - Allows you to specify start and end dates for redirects.</p> <p><strong><a href="https://drupal.org/sandbox/mdespeuilles/1449948" title="PDFThumb">PDFThumb</a></strong> - Provides automatic creation of PDF thumbnails in filefields.</p> <p><strong><a href="https://drupal.org/sandbox/davidarthur/1450346" title="Ubercart Combine Shipping">Ubercart Combine Shipping</a></strong> - Combine shipping costs for products that need to be shipped by different carriers into a single shipping cost.</p> <p><strong><a href="https://drupal.org/sandbox/pablo.cerda/1444666" title="Date Popup Restrictions">Date Popup Restrictions</a></strong> - Restrict the selectable days on a date popup widget. Can be done with form settings or even by using the result of a view!</p> <p><strong><a href="https://drupal.org/sandbox/mkadin/1447772" title="Report Builder">Report Builder</a></strong> - Report builder allows you to create a table or chart with each data point as the result of a view. Each view has its own set of exposed filters. This allows users to easily create graphs or tables that summarize drupal data, which they can reconfigure and play around with.</p> <p><strong><a href="https://drupal.org/project/jquery_ui_multiselect" title="jQuery UI Multiselect">jQuery UI Multiselect</a></strong> - This module integrates the jQuery UI Multiselect plugin with existing list widgets. The jQuery plugin is demonstrated at https://www.quasipartikel.at/multiselect.</p> <p><strong><a href="https://drupal.org/sandbox/kongoji/1445696" title="FileField Role Limit">FileField Role Limit</a></strong> - An extension of FileField module that adds the ability to limit the max upload file size for each different role.</p> <p><strong><a href="https://drupal.org/sandbox/tedbow/1444528" title="Weform Stepbar">Weform Stepbar</a></strong> - Provides a "step bar" at the top of multiple page Webforms.</p> <p><strong><a href="https://drupal.org/sandbox/darthsteven/1444654" title="Feeds d.o Issue Parser">Feeds d.o Issue Parser</a></strong> - <a href="https://drupal.org/project/feeds">Feeds</a> parser for drupal.org issue queue threads.</p> <p><strong><a href="https://drupal.org/project/rest_auth" title="REST Auth">REST Auth</a></strong> - Allows users to login using an external REST service.</p> <p><strong><a href="https://drupal.org/project/urban_airship" title="Urban Airship">Urban Airship</a></strong> - Allows site administrators to use a Drupal site to send push notifications to the Urban Airship service.</p> <p><strong><a href="https://drupal.org/project/mirror_alert" title="Mirror Alert">Mirror Alert</a></strong> - Helps you determine if other websites are mirroring your site with DNS or using your static assets.</p> </div> </div> <span>Wayne Eaker</span>February 24, 2012 <div class="tags"> <div class="container"> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/advertising" hreflang="en">Advertising</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/date-module" hreflang="en">Date module</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/drupal" hreflang="en">Drupal</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/drupal-8" hreflang="en">Drupal 8</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/drupal-commerce" hreflang="en">Drupal Commerce</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/drupalcon-denver" hreflang="en">DrupalCon Denver</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/drush" hreflang="en">Drush</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/e-commerce" hreflang="en">E-Commerce</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/email" hreflang="en">Email</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/entity-api" hreflang="en">Entity API</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/feeds-module" hreflang="en">Feeds module</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/filefield-module" hreflang="en">Filefield module</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/geoip" hreflang="en">GeoIP</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/high-performance" hreflang="en">High Performance</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/imagecache-module" hreflang="en">Imagecache module</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/ubercart" hreflang="en">Ubercart</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/views-module" hreflang="en">Views module</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/webform-module" hreflang="en">Webform module</a></span> </div> </div> Fri, 24 Feb 2012 15:17:41 +0000 Wayne Eaker 167 at https://www.zengenuity.com How to Import Files into Drupal CCK Fields https://www.zengenuity.com/blog/2010-11/how-import-files-drupal-cck-fields <span class="field field--name-title field--type-string field--label-hidden">How to Import Files into Drupal CCK Fields</span> <div class="paragraph html"> <div class="container"> <p>At last night's <a href="https://groups.drupal.org/ann-arbor">Ann Arbor Drupal Meetup</a>, a question was raised about how to write an import script to create <a href="https://drupal.org">Drupal</a> nodes that include a <a href="https://drupal.org/project/filefield">Filefield CCK</a> field. Filefields and <a href="https://drupal.org/project/imagefield">Imagefields</a> present a particular problem for import because the file must be stored into the Drupal files table before you can save them to the node. In the discussion that followed, it seemed that several of us at the meeting had developed our own ways to do this in the past for various reasons. So, I thought I would post a couple solutions for others who need to do this.</p> <h2>Option 1: Read the Manual</h2> <p>There is <a href="https://drupal.org/node/330421">a manual page that explains how to programmatically import files to Filefield</a>. However, like many Drupal manual pages, if you read through the comments, there are about 20 different versions of the code, and the discussion is often difficult for novice users to follow. The code on this page does work, but there is something simpler that we ended up with at the meeting.</p> <h2>Option 2: Use a Helper Function</h2> <p>The Filefield module has a helper function called <a href="https://api.lullabot.com/field_file_save_file">field_file_save_file()</a> that does a lot of the work for you. To use the function, you just need to give the original file path and a destination path if you want the file copied into a new location. Here's a simple example of a script that creates a story node and imports an image file into the "field_image" CCK field. (The file importing lines are highlighted.)</p> <pre><pre class="[8,9]'"> <?php $node = new StdClass(); $node->type = 'story'; $node->body = 'Testing.'; $node->title = 'Testing'; $file = field_file_save_file('import-images/buzz2.jpg', array(), 'sites/default/files/images'); $node->field_image = array($file); $node->uid = 1; $node->status = 1; node_save($node); </pre></pre> <p>This script can't be run on the command line without some other include lines to bootstrap the Drupal system. However, if you use <a href="https://drupal.org/project/drush">Drush</a> (and you should be using Drush), you don't need to do anything extra. Just run "<span><strong><span>drush scr import.php</span></strong></span>". That's it. Adding those two lines to your import script is all need to do to import files to Filefield CCK fields. Easy to do now that you know.</p> <p>If you have any questions or problems using the method above, leave a comment below, and I'll see if I can help you out.</p> </div> </div> <span>Wayne Eaker</span>November 30, 2010 <div class="tags"> <div class="container"> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/ann-arbor" hreflang="en">Ann Arbor</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/drupal" hreflang="en">Drupal</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/drupal-planet" hreflang="en">Drupal Planet</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/filefield-module" hreflang="en">Filefield module</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/imagefield-module" hreflang="en">Imagefield module</a></span> <span class="tag"><a href="https://www.zengenuity.com/blog/tags/import" hreflang="en">Import</a></span> </div> </div> Tue, 30 Nov 2010 15:28:12 +0000 Wayne Eaker 120 at https://www.zengenuity.com