<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>ThinkRobot &#187; uploads</title>
	<atom:link href="http://think-robot.com/tag/uploads/feed/" rel="self" type="application/rss+xml" />
	<link>http://think-robot.com</link>
	<description>Design &#38; Development Blog</description>
	<pubDate>Sun, 05 Sep 2010 23:09:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress NextGen gallery tweak</title>
		<link>http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/</link>
		<comments>http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 20:39:03 +0000</pubDate>
		<dc:creator>Joanna</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[fix]]></category>

		<category><![CDATA[gallery]]></category>

		<category><![CDATA[NextGen]]></category>

		<category><![CDATA[uploads]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.think-robot.com/?p=18</guid>
		<description><![CDATA[Recently I found myself in that very anoying situation where a very good piece of software seemed to lack just this one function&#8230; again. I have been doing a gallery website and used the NextGen gallery plugin to display the photos. Unfortunatelly it was a case of a gallery per post with about 1 or [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I found myself in that very anoying situation where a very good piece of software seemed to lack just this one function&#8230; again. I have been doing a gallery website and used the <a href="http://wordpress.org/extend/plugins/nextgen-gallery/" target="_blank">NextGen gallery plugin</a> to display the photos. Unfortunatelly it was a case of a gallery per post with about 1 or 2 photos per gallery.</p>
<p>The biggest issue with this setting was the process of creating galleries. By default in NextGen you create the gallery on one page, upload the images in another, and then create new post yet elsewhere. But there had to be a way to at least merge the gallery creation with photo upload, especially considering a new gallery form consisted of a single &#8220;gallery name&#8221; field.<span id="more-18"></span>Surprisingly enough after checking the code, both actions are actually processed in the same place. Thus by adding a new field on the photo upload form this time consuming problem could be solved:</p>
<p>Edit the file: <strong>wp-content/plugins/nggallery/admin/wp25/addgallery.php (line: 15)</strong></p>
<pre><code>// link for the flash file
$swf_upload_link = NGGALLERY_URLPATH . 'admin/wp25/upload.php';
$swf_upload_link = wp_nonce_url($swf_upload_link, 'ngg_swfupload');
//flash doesn't seem to like encoded ampersands, so convert them back here
$swf_upload_link = str_replace('&amp;', '&amp;', $swf_upload_link);

$defaultpath = $ngg_options['gallerypath'];

if ($_POST['addgallery']<strong> || !empty($_POST['newgalleryname'])</strong>){
  <strong>if(!empty($_POST['newgalleryname']))
    $_POST['galleryname'] = $_POST['newgalleryname'];</strong>
  check_admin_referer('ngg_addgallery');
  $newgallery = attribute_escape($_POST['galleryname']);
  if (!empty($newgallery))
    <strong>$_POST['galleryselect'] = </strong>nggAdmin::create_gallery($newgallery, $defaultpath);
}
if ($_POST['zipupload']){</code></pre>
<p>Edit the file: <strong>wp-content/plugins/nggallery/admin/wp25/addgallery.php (line: 263)</strong></p>
<pre><code>	&lt;tr valign="top"&gt;
		&lt;th scope="row"&gt;&lt;?php _e('in to', 'nggallery') ;?&gt;&lt;/th&gt;
		&lt;td&gt;&lt;select name="galleryselect" id="galleryselect"&gt;
		&lt;option value="0" &gt;&lt;?php _e('Choose gallery', 'nggallery') ?&gt;&lt;/option&gt;
		&lt;?php
			$gallerylist = $wpdb-&gt;get_results("SELECT * FROM $wpdb-&gt;nggallery ORDER BY gid ASC");
			if(is_array($gallerylist)) {
				foreach($gallerylist as $gallery) {
					echo '&lt;option value="'.$gallery-&gt;gid.'" &gt;'.$gallery-&gt;name.' | '.$gallery-&gt;title.'&lt;/option&gt;'."n";
				}
			}
		?&gt;
		&lt;/select&gt;<strong> &lt;label&gt;or &lt;input type="text" name="newgalleryname"  /&gt;&lt;/label&gt;</strong>
		&lt;br /&gt;&lt;?php echo _e('Note : The upload limit on your server is ','nggallery') . "&lt;strong&gt;" . ini_get('upload_max_filesize') . "Byte&lt;/strong&gt;n"; ?&gt;
		&lt;br /&gt;&lt;?php if ((IS_WPMU) &amp;&amp; wpmu_enable_function('wpmuQuotaCheck')) display_space_usage(); ?&gt;&lt;/td&gt;
	&lt;/tr&gt;</code></pre>
<p>Edit the file: <strong>wp-content/plugins/nggallery/admin/wp25/functions.php (line: 77)</strong></p>
<pre><code>if ($result) {
	nggallery::show_error(__('Gallery', 'nggallery').' &lt;strong&gt;'.$galleryname.'&lt;/strong&gt; '.__('already exists', 'nggallery'));
	return false;
} else {
	$result = $wpdb-&gt;query("INSERT INTO $wpdb-&gt;nggallery (name, path, title) VALUES ('$galleryname', '$nggpath', '$gallerytitle') ");
	if ($result) nggallery::show_message(__('Gallery', 'nggallery').' &lt;strong&gt;'.$wpdb-&gt;insert_id." : ".$galleryname.'&lt;/strong&gt; '.__('successfully created!','nggallery')."
".__('You can show this gallery with the tag','nggallery').'&lt;strong&gt; &lt;/strong&gt;');
	<strong>return $wpdb-&gt;insert_id;</strong>
}  </code></pre>
<div id="crp_related"><h2>Related Articles:</h2><ul><li><a href="http://think-robot.com/2008/11/nested-sortable-using-jtree-clickable-links/" rel="bookmark">Nested sortable using jTree - clickable links</a></li><li><a href="http://think-robot.com/2009/04/zend_db_select-multiple-table-joins-explained/" rel="bookmark">Zend_Db_Select multiple table joins explained</a></li><li><a href="http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/" rel="bookmark">Doctrine Many To Many With Extra Fields</a></li><li><a href="http://think-robot.com/2008/10/how-to-convert-pdt-projects-into-phpeclipse-projects/" rel="bookmark">How to convert PDT projects into PHPEclipse projects</a></li><li><a href="http://think-robot.com/2009/12/phpunit-selenium-screenshot-path-problem/" rel="bookmark">PHPUnit & Selenium - screenshot path problem</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://think-robot.com/2008/11/wordpress-nextgen-gallery-tweak/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
