<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Needing To Attach Unique Post ID To Uploaded Image and Add to Media Library</title>
		<link>https://legacy.forums.gravityhelp.com/topic/needing-to-attach-unique-post-id-to-uploaded-image-and-add-to-media-library</link>
		<description>Gravity Support Forums Topic: Needing To Attach Unique Post ID To Uploaded Image and Add to Media Library</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 22:22:33 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/needing-to-attach-unique-post-id-to-uploaded-image-and-add-to-media-library" rel="self" type="application/rss+xml" />

		<item>
			<title>jflayhart on "Needing To Attach Unique Post ID To Uploaded Image and Add to Media Library"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/needing-to-attach-unique-post-id-to-uploaded-image-and-add-to-media-library#post-286792</link>
			<pubDate>Wed, 29 May 2013 13:27:04 +0000</pubDate>
			<dc:creator>jflayhart</dc:creator>
			<guid isPermaLink="false">286792@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;So here's my updated code that seems to be working, but then the thumbnail isn't showing up in media library and then the link is created as a a href to the image instead of the image itself showing when viewing the attachment page:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//Add upload field images to media library
add_action(&#38;quot;gform_after_submission&#38;quot;, &#38;quot;set_post_content&#38;quot;, 10, 2);
	function set_post_content($entry, $form){

	    if($_FILES[&#38;#39;input_5&#38;#39;]) {

			require_once(ABSPATH . &#38;#39;wp-admin/includes/file.php&#38;#39;);

			require_once(ABSPATH . &#38;#39;wp-admin/includes/image.php&#38;#39;);

			require_once(ABSPATH . &#38;#39;wp-admin/includes/media.php&#38;#39;);

			$filename = $entry[5];

			$attachment = array(
				&#38;#39;guid&#38;#39; =&#38;gt; $wp_upload_dir[&#38;#39;url&#38;#39;] . &#38;#39;/&#38;#39; . basename( $filename ),
				&#38;#39;post_mime_type&#38;#39; =&#38;gt; $wp_filetype[&#38;#39;type&#38;#39;],
				&#38;#39;post_title&#38;#39; =&#38;gt; preg_replace(&#38;#39;/\.[^.]+$/&#38;#39;, &#38;#39;&#38;#39;, basename($filename)),
			);

			$attach_id = wp_insert_attachment($attachment, $filename);;

			$attach_data = wp_generate_attachment_metadata($attach_id, $filename);

			wp_update_attachment_metadata($attach_id, $attach_data);
		}
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>jflayhart on "Needing To Attach Unique Post ID To Uploaded Image and Add to Media Library"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/needing-to-attach-unique-post-id-to-uploaded-image-and-add-to-media-library#post-284946</link>
			<pubDate>Tue, 28 May 2013 23:58:24 +0000</pubDate>
			<dc:creator>jflayhart</dc:creator>
			<guid isPermaLink="false">284946@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;David, could you elaborate exactly how that works? I've been reading up on it and know that's what I need, just not sure about the &#34;how.&#34; Also, how do I check priority support messages?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Needing To Attach Unique Post ID To Uploaded Image and Add to Media Library"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/needing-to-attach-unique-post-id-to-uploaded-image-and-add-to-media-library#post-282068</link>
			<pubDate>Tue, 28 May 2013 00:51:35 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">282068@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;In addition to this topic, I replied to the priority support request which was submitted.  I will leave this open though since there is good information here.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Needing To Attach Unique Post ID To Uploaded Image and Add to Media Library"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/needing-to-attach-unique-post-id-to-uploaded-image-and-add-to-media-library#post-280968</link>
			<pubDate>Mon, 27 May 2013 12:09:52 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">280968@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Yea, so you would have to combine that with our gform_after_submission hook, and have fields already available (hidden fields?) to take the data. &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_after_submission&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_after_submission&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jflayhart on "Needing To Attach Unique Post ID To Uploaded Image and Add to Media Library"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/needing-to-attach-unique-post-id-to-uploaded-image-and-add-to-media-library#post-280875</link>
			<pubDate>Mon, 27 May 2013 11:22:18 +0000</pubDate>
			<dc:creator>jflayhart</dc:creator>
			<guid isPermaLink="false">280875@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Here is a snippet of code from the EXIF plugin:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//render shortcode
		function shortcode($atts, $content = null) {
			global $post;
			$post_options = get_post_meta($post-&#38;gt;ID, &#38;#39;_use_exif&#38;#39;, true);
			if ($post_options)
				$post_options = $post_options;
			else
				$post_options = &#38;quot;all&#38;quot;;

			extract(shortcode_atts(array(
				&#38;#39;show&#38;#39; =&#38;gt; $post_options,
				&#38;#39;id&#38;#39; =&#38;gt; &#38;#39;&#38;#39;,
			), $atts));

			$images = get_children(array(
				&#38;#39;post_parent&#38;#39; =&#38;gt; $post-&#38;gt;ID,
				&#38;#39;post_type&#38;#39; =&#38;gt; &#38;#39;attachment&#38;#39;,
				&#38;#39;numberposts&#38;#39; =&#38;gt; 1,
				&#38;#39;post_mime_type&#38;#39; =&#38;gt; &#38;#39;image&#38;#39;,
				&#38;#39;orderby&#38;#39; =&#38;gt; &#38;#39;ID&#38;#39;,
				&#38;#39;order&#38;#39; =&#38;gt; &#38;#39;ASC&#38;#39;
				));
			if ($images) {
				foreach ($images as $image) {
					$imageID = $image-&#38;gt;ID;
				}
			}

			if ($id == &#38;#39;&#38;#39;)
				$imgID = $imageID;
			else
				$imgID = $id;

			$display = $show;

			return $this-&#38;gt;display_exif($display,$imgID);
		}

		//auto insert
		function auto_insert($content) {
			$options = $this-&#38;gt;get_options();
			if (isset($options[&#38;#39;auto_insert&#38;#39;]) &#38;amp;&#38;amp; (!is_page()))
				return $content . $this-&#38;gt;display_exif();
			else
				return $content;
		}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>jflayhart on "Needing To Attach Unique Post ID To Uploaded Image and Add to Media Library"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/needing-to-attach-unique-post-id-to-uploaded-image-and-add-to-media-library#post-273448</link>
			<pubDate>Fri, 24 May 2013 11:33:59 +0000</pubDate>
			<dc:creator>jflayhart</dc:creator>
			<guid isPermaLink="false">273448@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;My clients are taking pictures on their mobile devices and submitting them to my site via gravity forms, but I need to be able to grab the EXIF data from images to get the GPS coords from the image data...&#60;/p&#62;
&#60;p&#62;I am using &#60;a href=&#34;http://wordpress.org/plugins/thesography/&#34; rel=&#34;nofollow&#34;&#62;http://wordpress.org/plugins/thesography/&#60;/a&#62; and it works using its shortcode only on images uploaded to the media library by taking its post id and spitting out all the EXIF data of that attachment's post id. I want to hack this plugin and make it work with a Gform hook or something or else make Gforms add the uploaded image automatically to the Media Library upon form submission, so that I can just use the other plugin's shortcode data to take over from there as Gravity Forms assigns a post id to that newly added Media attachment. What's the best way to go about this?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
