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.

Image - Post Content - no hyperlink ?

  1. Gil Namur
    Member

    Hi there,
    So I have created a form that allows users to add images and it works fantastic!
    But - when I view the post, there is no hyperlink for the image.

    If I insert an image from the WP gallery into a post, it adds a hyperlink to either the post URL or the file URL.

    Is there a way to have the inserted image contain that hyperlink (either will do)?

    Thanks and cheers,
    Gil

    Posted 13 years ago on Monday January 24, 2011 | Permalink
  2. It seems like this provides the answer:

    http://forum.gravityhelp.com/topic/custom-image-width-and-height#post-15843

    With this being the key:

    {Post Image:7:src}

    You would use it like this, I think:

    <a href="{Post Image:7:src}">{Post Image:7:thumbnail:left}</a>

    to link the thumbnail to the full size image.

    It seems like that should work, but I'm having trouble testing it on my server (using the 1.5.rc3.8 release.) Maybe there's something I'm missing, but maybe that will point you in the right direction.

    Posted 13 years ago on Monday January 24, 2011 | Permalink
  3. Gil Namur
    Member

    Hi Illinois Harley,
    Thanks so much! I tried this and several versions and all I get is a link like this
    http://photos.lifeasahuman.com/%3Cimg%20width=

    which of course returns a 404.
    I will keep noodling but if an admin here has an answer please let us know!
    Cheers,
    Gil

    Posted 13 years ago on Monday January 24, 2011 | Permalink
  4. Hm, what IllinoisHarley suggested above should work; however, when I tested it on my dev server it did not appear to do so. I will forward this on to wiser eyes then my own.

    Posted 13 years ago on Monday January 24, 2011 | Permalink
  5. Gil Namur
    Member

    Thanks David!

    Posted 13 years ago on Monday January 24, 2011 | Permalink
  6. We were just slightly off with the syntax. :)

    <a href="{Post Image:6:full:url}">{Post Image:6:thumbnail}</a>

    Posted 13 years ago on Thursday January 27, 2011 | Permalink
  7. Gil Namur
    Member

    Hi David ..
    Thanks ... almost!

    <a href="{Post Image:1:4:full:url}">{Post Image:1:4:medium:center}</a>

    Is what I used. It inserts the medium image and gives a link but the link is to the actual article itself rather than to the full size image or post url. Here is what is generated vs what I need generated.

    HTML Generated By From Form
    <p><a href="Test 10000"><img class="size-medium aligncenter wp-image-702" title="Orcas Yard pics July 23 06 016_resize" src="http://photos.lifeasahuman.com/files/2011/01/Orcas-Yard-pics-July-23-06-016_resize1-550x412.jpg" alt="Orcas Yard pics July 23 06 016_resize" width="550" height="412" /></a></p>

    HTML Generated By Wordpress manually inserting image from gallery with FULL URL option
    <p><a href="http://photos.lifeasahuman.com/files/2011/01/Orcas-Yard-pics-July-23-06-016_resize1.jpg"><img class="aligncenter size-medium wp-image-702" title="Orcas Yard pics July 23 06 016_resize" src="http://photos.lifeasahuman.com/files/2011/01/Orcas-Yard-pics-July-23-06-016_resize1-550x412.jpg" alt="" width="550" height="412" /></a></p>

    HTML Generated By Wordpress manually inserting image from gallery with POST URL option
    <p><a rel="attachment wp-att-702" href="http://photos.lifeasahuman.com/?attachment_id=702"><img class="aligncenter size-medium wp-image-702" title="Orcas Yard pics July 23 06 016_resize" src="http://photos.lifeasahuman.com/files/2011/01/Orcas-Yard-pics-July-23-06-016_resize1-550x412.jpg" alt="" width="550" height="412" /></a></p>

    Suggestions?
    Thanks and cheers,
    Gil

    Posted 13 years ago on Thursday January 27, 2011 | Permalink
  8. Gil, what do you mean "the link is to the actual article itself"? I understand you want it linked to the full size image or the post, but what is the article? I can't tell from the code you posted. I'd like to learn how to do this as well.

    Posted 13 years ago on Thursday January 27, 2011 | Permalink
  9. Gil Namur
    Member

    Hi Illinois!
    Suppose the article is called www dot yoursite.com/my-new-harley/. When you click on the image in the article, the link embedded in the image is a link to the article www dot yoursite.com/my-new-harley/`
    rather than www dot yoursite.com/my-new-harley/theimage.jpg (FULL URL)
    or www dot yoursite.com/my-new-harley/attachment/theimage.jpg (POST URL)
    Cheers,
    Gil

    Posted 13 years ago on Thursday January 27, 2011 | Permalink
  10. <a href="{Post Image:1:4:full:url}">{Post Image:1:4:medium:center}</a>

    I noticed you had a "1" and a "4". There should only be one number in there.

    Posted 13 years ago on Friday January 28, 2011 | Permalink
  11. Gil Namur
    Member

    HI David,
    Which one? The 1 or the 4?
    Thanks
    Gil

    Posted 13 years ago on Sunday January 30, 2011 | Permalink
  12. Gil Namur
    Member

    Hi again David,

    So I have tried this with both numbers and neither work. My confusion about the number stems from the fact that when I insert images into the article in the form (post body using a Post content template), I enter form field (image 1) and the size (medium center) which returns this.
    {Image 1:4:medium:center}

    2 numbers

    In our case we use 3 image fields so we also have
    {Image 2:8:medium:center}
    {Image 3:11:medium:center}

    What version of Gravity Forms were you testing this on? I am still at 1.4.5
    At any rate, I have spent way to much time on this. We will just delete the entered images in the post and re-enter them from the gallery for now until I can get this resolved.

    I suggest that a nice (and elegant) feature would be to add a second drop down box - Select Image Link - when inserting images in the form.

    Insert Form Field - Image X .... Select Image Size ... Select Image Link (choices for WP are None, POST URL or FILE URL)

    Cheers,
    Gil

    Posted 13 years ago on Monday January 31, 2011 | Permalink
  13. Hi Gil,

    Sorry this has become a hassle for you. I tested on 1.4.5 and it the code I provided worked alright.

    Working
    <a href="{Post Image:3:full:url}">{Post Image:3:thumbnail}</a>

    The code you had posted with the two numbers had an extra semicolon which is why I said it should not have two numbers as I thought you were attempting to pass two field IDs. If the first number is part of the field name, then it should be there, just not with a semicolon in front of it.

    If you'd like to send your login to david@rocketgenius.com, I can take a look and see what the issue is.

    Posted 13 years ago on Monday January 31, 2011 | Permalink
  14. Gil Namur
    Member

    Hi David,
    Thanks .. I will try this again soon. I am swamped right now with other things. I wonder if its an MU issue?
    Talk soon
    Gil

    Posted 13 years ago on Monday January 31, 2011 | Permalink
  15. Gil Namur
    Member

    Hi David,

    I think it's a WP MU issue! DANG! I tested your code at a NON MU site and works perfect. Same code at an MU site fails.
    I'll dig into this a bit more and see where I get and let you know. Sorry I doubted you (well I didn't really doubt you but jeez Louise!) MU can be a real pain for some things! Do you guys have an MU test bed?

    Cheers,
    Gil

    Posted 13 years ago on Monday January 31, 2011 | Permalink
  16. Gil Namur
    Member

    David!!
    I FOUND THE PROBLEM!!!!
    If the form has the images entered first (before the body field), the code works great!
    If the form has the body field first, the code fails! Check it out! I tried in MU and NON MU!
    Bug?
    Cheers,
    Gil

    Posted 13 years ago on Tuesday February 1, 2011 | Permalink
  17. Hm, I was unable to recreate this issue. Is it an option for you to upgrade to the latest 1.5 RC and verify whether you can recreate this issue?

    Posted 13 years ago on Thursday February 3, 2011 | Permalink
  18. Gil Namur
    Member

    Hi David,
    hmm .. well .. maybe at one of my test sites .. ok leme chew on that!
    I presume you tried to recreate this in 1.5 RC? When will 1.5 go to release? Weeks? Months?
    Cheers,
    Gil

    Posted 13 years ago on Thursday February 3, 2011 | Permalink

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