Adding images to weblog entries
Posted: 21 December 2007 01:57 PM   [ Ignore ]
Administrator
Rank
Total Posts:  14
Joined  2005-12-12

I’m wanting to have a weblog SAEF that users can optionally add up to 3 images to.

I have a weblog SAEF set up and my GX2 form embedded - is that right - can I do that?  Will one submit button submit both things?  Or do I have to submit the images independently?

Profile
 
 
Posted: 29 December 2007 12:38 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18

ruraldreams,

That’s almost right… the trouble is that Gallery Extended needs to know the Entry ID of the entry for it to post to as related.
A clever work-around that can be done is creating a two-page SAEF form. The first being the standard SAEF form WITH Mitchell’s nifty little SAEF Redirect extension. It allows you to specify a return url with the future Entry ID in it.

The second template page would then have the GX2 form in it, along with the related_id="{entry_id}” parameter, but setting it as related_id="{segment_3}” to grab the Entry ID from the URL so the form will post the images to the Weblog Entry.

This is the cleanest way currently available… the neat thing is you could also have a Preview of the Entry on that second template page along with the GX2 Form.

Let me know if you have any further questions smile

 Signature 
Profile
 
 
Posted: 31 December 2007 09:51 AM   [ Ignore ]   [ # 2 ]
Administrator
Rank
Total Posts:  14
Joined  2005-12-12

Thanks Pie Man - I got it working!  I was scared I’d need to be a javascript whiz.  I’m composing the GX2 missing manual now in my head ...

Profile
 
 
Posted: 06 April 2008 10:54 PM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  17
Joined  2005-11-10

I’m trying to set this up on a site. I have the SAEF redirecting to a page which includes the entry id at the end, so the SAEF redirect part of the system is working. I’m then using this code on the page to which the SAEF redirects (actually, the code is in another template which is embedded in the template which drives to redirect-to page):

{exp:gallery_extended:entry_form gallery_name="maingallery" return="afghanistan/submitthankyou" override_resize="no" related_id="{segment_3}”} 

<div class="
defaultBold">File:</div>
<input type="
file" class="form" name="image1" size="35" />

<div class="
defaultBold">Title:</div> 
<input type="
text" class="form" size="75" maxlength="100" name="title" value="" />

<div class="
defaultBold">Custom Field 1:</div>
<input type="
text" name="custom_field_one" class="form" size="75" maxlength="100" value="" />

<div class="
defaultBold">Caption:</div>
<textarea name="
caption" cols="75" rows="5" class="form" id="caption"></textarea>

<select name="
category">
{category_menu} 
<option value="
{cat_id}">{cat_name} 
{/category_menu} 
</select>

<input name="
submit" type="submit" class="form" value=" Upload Photo " />

<input type="
hidden" name="apply_watermark" value="y" />
<input type="
hidden" name="allow_comments" value="y" />
<input type=’hidden’ name="
status" value="o" />
<input type="
hidden" name="entry_date" id="entry_date" value="{current_time format="%Y-%m-%d %h:%i %A"}" />

{/exp:gallery_extended:entry_form}

As you can see, for the moment I’m just using the example from the gallery extended documentation to test the functionality.

Then, in the code for the entry where I want to display thumbnails of the image, I’m using this code in between the exp:weblog:entries tags (this is on a page which shows multiple entries from the same weblog):

{exp:gallery_extended:entries gallery_name="maingallery" related_id="{entry_id}"}
<img src="{thumb_url}"  class="border" title="{title}"  alt="{title}" />
{/exp:gallery_extended:entries}

There are currently three images in maingallery, only one of which I uploaded through the gallery_extended form. If I use the code above, no images appear. If I remove the related_id parameter, all three images appear.

Any thoughts on how I can get just the one image I uploaded in association with the weblog entry to appear?

Thanks in advance for any help anyone can offer - I appreciate it!

Frank

Profile
 
 
Posted: 07 April 2008 06:15 AM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18

Frank,

As a start, can you go into the Gallery Extended CP and in the Manage Entries tab, click on the image you “related” to the entry.

If it properly related itself, there should be data in the Related ID and Related Type fields. smile

Let me know what you see! rasberry

Also, you’ll need to add an additional parameter to your first code example:

type="weblog"

 Signature 
Profile
 
 
Posted: 07 April 2008 06:49 AM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  17
Joined  2005-11-10

Thanks Pie Man. The image I uploaded yesterday has a “0” for the related id and nothing for related type.

Frank

Profile
 
 
Posted: 07 April 2008 06:55 AM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18

Try another one with that parameter added and we’ll see what happens smile

 Signature 
Profile
 
 
Posted: 07 April 2008 07:38 AM   [ Ignore ]   [ # 7 ]
Newbie
Rank
Total Posts:  17
Joined  2005-11-10

Pie Man:

I tried it again, but got the same result - no related id and no related type.

Thanks,
Frank

Profile
 
 
Posted: 07 April 2008 07:47 AM   [ Ignore ]   [ # 8 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18

If your code is exactly as it is above (formatting), then the issue appears to be a couple of the quotations (around “related_id” parameter, and hidden status form field):

{exp:gallery_extended:entry_form gallery_name="maingallery" return="afghanistan/submitthankyou" type="weblog" override_resize="no" related_id="{segment_3}"

<div class="defaultBold">File:</div>
<
input type="file" class="form" name="image1" size="35" />

<
div class="defaultBold">Title:</div
<
input type="text" class="form" size="75" maxlength="100" name="title" value="" />

<
div class="defaultBold">Custom Field 1:</div>
<
input type="text" name="custom_field_one" class="form" size="75" maxlength="100" value="" />

<
div class="defaultBold">Caption:</div>
<
textarea name="caption" cols="75" rows="5" class="form" id="caption"></textarea>

<
select name="category">
{category_menu} 
<option value="{cat_id}">{cat_name} 
{
/category_menu} 
</select>

<
input name="submit" type="submit" class="form" value=" Upload Photo " />

<
input type="hidden" name="apply_watermark" value="y" />
<
input type="hidden" name="allow_comments" value="y" />
<
input type="hidden" name="status" value="o" />
<
input type="hidden" name="entry_date" id="entry_date" value="{current_time format="%Y-%m-%%h:%%A"}" />

{/exp:gallery_extended:entry_form}

Try that smile

 Signature 
Profile
 
 
Posted: 07 April 2008 08:09 AM   [ Ignore ]   [ # 9 ]
Newbie
Rank
Total Posts:  17
Joined  2005-11-10

Wow - you have good eyes. That did the trick.

Thanks so much for your help!

Frank

Profile
 
 
Posted: 07 April 2008 08:12 AM   [ Ignore ]   [ # 10 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18

Haha, well, I thank the code coloring rasberry
If something’s out… like in your case, it went all opposite, etc

 Signature 
Profile