PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

File Location

  1. Just a quick question:

    upload file or upload image -> where does it get saved to via location and how does it get saved?

    More specifically, if a post is made and image uploaded, does it get set as a default featured image in the post, or just uploads to location?

    I'm using it in my LOOP like so:

    " rel="bookmark" title="<?php the_title();?>"><?php the_post_thumbnail(); ?>

    Posted 14 years ago on Tuesday November 23, 2010 | Permalink
  2. I need to be more specific:

    Currently it appears GF bypasses WordPress upload functions for images. By default WP uploads images in 4 variations (thumb, medium, large, original) and the root path is wp-content/uploads/

    GF is affected strangely and has the following root path when "Organize my uploads into month- and year-based folders" is checked:

    wp-content/uploads/gravity_forms/2/2010/11

    seems really extreme to me. I believe it maybe this that causes the_post_thumbnail() function not to work as expected. How can I get it to register the images by post within the loop?

    Posted 14 years ago on Tuesday November 23, 2010 | Permalink
  3. There are 2 different ways to upload images via a form in Gravity Forms. One is designed for images for forms that create a post and the other is a generic upload field.

    The Post Image field uploads files directly to your Media Library. They get stored like any other image in your Media Library with multiple sizes created.

    The File Upload field does not go to your Media Library. They are stored in a gravity_forms upload folder in your wp-content/uploads folder.

    If you are creating a post and want users to upload images then you should be using the Post Image field, not the File Upload field.

    Posted 14 years ago on Tuesday November 23, 2010 | Permalink
  4. if that's the case then, logically, <?php the_post_thumbnail(); ?> should work without issue.

    I know your post is basically a copy&paste from similar questions, but perhaps wordpress 3 is causing issue?

    I can hand code a post and uplaod an image (not display it), save the post and run my basic script:

    <script src='http://pastie.org/1321067.js'></script>

    If what you say is true, then when a form is submitted with Image upload in it it should register in the gallery and be able to be called with the above code. It currently does not do this.

    Posted 14 years ago on Tuesday November 23, 2010 | Permalink
  5. My response was not a copy-n-paste from other posts. It was a direct response to your request above.

    Here is how you can see if the post images are being saved.

    Submit your form with some images using the Post Image fields. Then go to Posts, Edit the post that was just created and in the Insert/Upload toolbar of the post editor click on the Image icon. Look at what is in the Gallery for that post. It should be the images that were uploaded.

    The post thumbnail you are referring to is the feature image/post thumbnail functionality added in WordPress 2.9 and enhanced in WordPress 3.0. This is a different feature than the Gallery and you have to set which image is the post thumbnail in the post editor. It doesn't automatically do this for you because it doesn't know which of the images uploaded should be used for the post thumbnail.

    Gravity Forms doesn't currently integrate with the featured image/post thumbnail functionality which is not the same as the post gallery/media library which Gravity Forms does add images to.

    Posted 14 years ago on Tuesday November 23, 2010 | Permalink
  6. hmm. So, in a nutshell, I can't do it using really simple and predefined wordpress functions but have to get my hands dirty and write some actual code.

    No reason to get your back up against the wall either, mate. I know dealing with people can be irritating sometimes, but unlike talking in person, it's much harder to hide that irritation in writing.

    As I am certain I am not the only one with this question or approach, I will write up some code and test it - then I will post it up here for others to copy&paste.

    For reference, the base code will be written to take a single image (thumbnail) uploaded via GF and displayed somewhere in the LOOP. I'll be sure to comment nicely the code so a new programmer can understand it as much as the old.

    As I don't -really- get code based answers from ya, Carl, I obviously need to write my own - but I do want to save anyone else the trouble.

    Posted 14 years ago on Tuesday November 23, 2010 | Permalink
  7. as promised - code from Smashing WordPress, Beyond the Blog by Thord Daniel Hedengren

    <?php while (have_posts()) : the_post(); ?>
    
    <!-- Thumbnail with description -->
    			<div id="post-<?php the_ID(); ?>" <?php post_class('gallerylisting'); ?>>
    			<?php
    				$args = array(
    					'numberposts' => 1, //the amount of images to retrieve
    				    'post_type' => 'attachment', //defined post type
    				    'status' => 'publish', //the status of the post (draft, published, etc)
    				    'post_mime_type' => 'image', //e.g. image, video, video/mp4
    				    'post_parent' => $post->ID //the ID of the post we want to use
    				);
    				$images = &get_children($args); //post is the parent, and attachments are children of parent.  Get the children
    				foreach ( (array) $images as $attachment_id => $attachment ) { //loop through the post attachments
    
    				?>
    					<div class="gallerylisting-thumb">
    						<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    							<?php
    							//we create the image as a link to the post with the <a> tag above
    							 echo wp_get_attachment_image($attachment_id, 'thumbnail', '');
    							 //and output the resulting image.  'thumbnail' can be replaced with
    							 //thumbnail, medium, large or full for image size
    							?>
    						</a>
    					</div>
    					<div class="gallerylisting-desc">
    						<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    						<?php
    						//above we link the title of the post as clickable
    						//and follow it up with post content, such as the excerpt
    						the_excerpt();
    						//any post custom fields, meta, and anything else can be added here as well
    						?>
    					</div>
    			<?php } ?>
    			</div>
    			<!-- /ends -->
    
    <?php endwhile; ?>
    Posted 14 years ago on Tuesday November 23, 2010 | Permalink
  8. gday URmedia, can I be so vain as to ask you where you placed the posted code above please? in which file?

    thanking you in advance

    Posted 13 years ago on Tuesday January 11, 2011 | Permalink
  9. Sbyrakis
    Member

    Thank you URmedia, you just saved days of my life!!!
    :)
    Stelios

    Posted 13 years ago on Monday March 28, 2011 | Permalink
  10. URmedia Thanks again!

    Posted 13 years ago on Friday October 7, 2011 | Permalink

This topic has been resolved and has been closed to new replies.