# Page\_attachments experience

**URL:** <https://www.ruby-forum.com/t/page-attachments-experience/124826>\
**Category:** Radiant CMS\
**Created:** [January 2, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826 "2008-01-02T22:23:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 2, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/1 "2008-01-02T22:23:08Z")

</div>

I’m curious how well page\_attachments has worked for others. I’m going  
to give it a try in my test environment, but wondering how it’s worked  
for end users who may or may not be computer savvy (from a programmer’s  
perspective).

Are there any other options, aside from writing my own extension,  
currently available to make it easy for end users to add images to the  
pages they create?

Thank you for any comments!

Bill

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 2, 2008, 10:28pm UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/2 "2008-01-02T22:28:59Z")

</div>

I’m pretty happy with page\_attachments. The biggest headache for me  
was installing RMagick or image\_science on my Mac dev machine (I don’t  
know why this is still such a pain in the a$$!). It’s running great  
on my Ubuntu Server though.

Usability-wise, the thumbnails it adds to the page admin interface are  
really good. As are the \<r:attachment:\*\> tags. My only complaint is  
that styles seem just a little bit off from the rest of the UI, but  
all things considered, that’s not too bad.

I recommend you use it. For what it sounds like you want to do, it’s  
perfect.

-Andrew

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 3, 2008, 5:19pm UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/3 "2008-01-03T17:19:56Z")

</div>

Andrew O’Brien wrote:

> I recommend you use it. For what it sounds like you want to do, it’s perfect.
> 
> -Andrew

It also works fine for me. No problems yet!

Cheers,  
Mohit.  
1/4/2008 | 12:18 AM.

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 3, 2008, 9:40pm UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/4 "2008-01-03T21:40:45Z")

</div>

I think this is a top notch extension. However I will try to patch it so  
the  
admin view can display the ‘public’ url for easy copy pasting with  
wysiwyg  
editors.

P.

On Jan 3, 2008 5:18 PM, Mohit S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> Mohit.  
> 1/4/2008 | 12:18 AM.
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
met vriendelijke groet,

Peter B.

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 4, 2008, 4:26am UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/5 "2008-01-04T04:26:19Z")

</div>

Saji N. Hameed wrote:

> saji

That may be true - I’m managing my site by myself and I’m not a lay  
person in that sense. But, in a technical sense, it works fine.

Cheers,  
Mohit.  
1/4/2008 | 11:25 AM.

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 4, 2008, 9:05am UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/6 "2008-01-04T09:05:42Z")

</div>

> Sorry, but not very easy to use for the lay person client who may have no  
> idea  
> about radius tags.
> 
> saji
> 
> True, that’s why I will try to patch it with some easy copy/paste URL  
> thingy. (like photobucket and the like)

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 4, 2008, 1:33am UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/7 "2008-01-04T01:33:21Z")

</div>

- Mohit S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2008-01-04 00:18:40 +0800]:

> Andrew O’Brien wrote:
> 
> > I’m pretty happy with page\_attachments. The biggest headache for me  
> > was installing RMagick or image\_science on my Mac dev machine (I don’t  
> > know why this is still such a pain in the a$$!). It’s running great  
> > ---------snip
> 
> It also works fine for me. No problems yet!
> 
> Cheers,  
> Mohit.  
> 1/4/2008 | 12:18 AM.

Sorry, but not very easy to use for the lay person client who may have  
no idea  
about radius tags.

saji

> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
Saji N. Hameed

APEC Climate Center +82 51 668 7470  
National Pension Corporation Busan Building 12F  
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed\_email\_address@domain.invalid  
KOREA

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 8, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/8 "2008-01-08T20:34:13Z")

</div>

On Jan 7, 2008 4:16 PM, J Aaron F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> One way I use the page\_attachements extension is to create a single  
> page under Root called Assets and then attach “global” files to this  
> page. I can then reference them directly by URL, but it would be nice  
> to have a tag that allowed for referencing of attachments of other  
> pages.

I did a quick hack patch to do something like this. BUt I discovered  
page\_attachment would also pick up images from parent pages. So adding  
all  
the images to the home page is also an option.

$ diff -u page\_attachment\_tags.rb.orig page\_attachment\_tags.rb  
— page\_attachment\_tags.rb.orig 2007-12-26 21:49:41.234538413  
+1300  
+++ page\_attachment\_tags.rb 2007-12-26 22:20:39.262566335 +1300  
@@ -86,6 +86,23 @@  
attributes = tag.attr.inject([]){ |a,(k,v)| a \<\< %{#{k}=“#{v}”}  
}.join(" “).strip  
%{\<img src=”#{filename}" #{attributes + " " unless attributes.empty  
?}/\>}  
end  
+

- desc %{
- Test
- 
- _Usage_:
- 
- 

```
<r:attachment:global name="file.jpg"

```

`
`
`
`

`[size=“icon”]/>`

- }

- tag “attachment:global” do |tag|

- page = tag.locals.page

- attachment = PageAttachment.find\_by\_filename(tag.attr[‘name’])

- size = tag.attr[‘size’] || nil

- raise TagError, “attachment is not an image.” unless  
attachment.content\_type.strip =~ /^image//

- filename = attachment.public\_filename(size) rescue “”

- attributes = tag.attr.inject([]){ |a,(k,v)| a \<\< %{#{k}=“#{v}”}  
}.join(" ").strip

- %{\<img src=“#{filename}” #{attributes + " " unless attributes.empty  
?}/\>}

- end

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 7, 2008, 4:17am UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/9 "2008-01-07T04:17:25Z")

</div>

“Peter B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> > Sorry, but not very easy to use for the lay person client who may have no  
> > idea  
> > about radius tags.
> > 
> > saji
> > 
> > True, that’s why I will try to patch it with some easy copy/paste URL  
> > thingy. (like photobucket and the like)

One way I use the page\_attachements extension is to create a single  
page under Root called Assets and then attach “global” files to this  
page. I can then reference them directly by URL, but it would be nice  
to have a tag that allowed for referencing of attachments of other  
pages.

–  
J Aaron F. [jadetower.com](http://jadetower.com) [US] +1 724-964-4515  
é¦®å‚‘ä» [cubiclemuses.com](http://cubiclemuses.com) [HK] +852 8123-7905

---

<div class="post-metadata">

**Author:** ![bburcham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f9ae1b/32.png) [@bburcham](https://www.ruby-forum.com/u/bburcham)\
**Post date:** [January 12, 2008, 8:24pm UTC](https://www.ruby-forum.com/t/page-attachments-experience/124826/10 "2008-01-12T20:24:13Z")

</div>

J Aaron F. wrote:

> > > 
> > 
> > thingy. (like photobucket and the like)
> 
> One way I use the page\_attachements extension is to create a single  
> page under Root called Assets and then attach “global” files to this  
> page. I can then reference them directly by URL, but it would be nice  
> to have a tag that allowed for referencing of attachments of other  
> pages.

Umm…

[1] I can’t try it out right now, but I remember reading that  
page\_attachments searches up the tree (of parents) to find if something  
matches the name.

[2] I can’t try it right now, but Radiant/ Radius allow you to do a  
find\_by\_url for a page and that switches the Radius context to the page  
that you just found. After that, using page\_attachments tags should  
mean that they search local to the page you just found. That would  
allow you to reference the attachment of the other page.

Like I said, I can’t try these out right now, so I’m not sure if they  
work. Sean, of course, could confirm 😃

Cheers,  
Mohit.  
1/13/2008 | 3:23 AM.
