How to add images to pages?

I need to be able to upload and link to images – for use with dynamic
pages and/or blog entries. I don’t see an obvious way to do that – am
i just missing it? Or would I need to create it?

It’ll need the standard 2 parts: 1. upload the pic; 2. select a pic
for use in your page.

Any suggestions?

Thanks!
-Tom

On 17/08/2006, at 5:00 AM, Tom W. wrote:

I need to be able to upload and link to images – for use with dynamic
pages and/or blog entries. I don’t see an obvious way to do that – am
i just missing it? Or would I need to create it?

It’ll need the standard 2 parts: 1. upload the pic; 2. select a pic
for use in your page.

Any suggestions?

Tom, this feature isn’t in Radiant (yet.) but there is a patch on trac
[1] that gets you most of the way there. I believe some other people
are working on a more streamlined solution, but it hasn’t been
mentioned on the mailing list in a little while, so I’m not sure what
is happening there.

Bodhi

[1] http://dev.radiantcms.org:9007/radiant/ticket/147 ignore the spam
:slight_smile:

Hi,
I did the page_part_types patch before, which allows having parts of
different types.
I’m not sure there was a huge interest at it at the time, but I use it
for a
site that my writers are not very computer capable.
For that I have created a few page parts types like - a wysiwyg part, a
asynch image upload page (for mass image upload), an event part, a one
image upload part and a tags part.
If you are interested and if that seems to answer your need you can
write
back to me, at the moment there is no patch for the 0.5 version.
Dror

bodhi wrote:

On 18/08/2006, at 12:20 AM, dror tirosh wrote:

Hi,
I did the page_part_types patch before, which allows having parts of
different types.
I’m not sure there was a huge interest at it at the time, but I use it
for a site that my writers are not very computer capable.

I’m using it here :slight_smile:

If you are interested and if that seems to answer your need you can
write back to me, at the moment there is no patch for the 0.5 version.
Dror

Dror, does the patch on trac not work for 0.5.2?

Bodhi

I have been using this a lot as well. The patch fails with 0.5.2, but I
think it is something minor to fix (I ran a bunch of patches at once, so
I am not real clear). In any case I have it working.

I do have one problem, when one chooses a attachment part_type, but does
not upload an attachtement, I get an error. The if params[:file] should
take care of this, but does not seem to.

This idea makes Radiant into an even more flexible system. I just
created a site with a gallery, using this. Each image is it’s own page,
a child of the gallery itself. This allows me to use the normal Radius
tags and makes setup a snap.

On 18/08/2006, at 12:20 AM, dror tirosh wrote:

Hi,
I did the page_part_types patch before, which allows having parts of
different types.
I’m not sure there was a huge interest at it at the time, but I use it
for a site that my writers are not very computer capable.

I’m using it here :slight_smile:

If you are interested and if that seems to answer your need you can
write back to me, at the moment there is no patch for the 0.5 version.
Dror

Dror, does the patch on trac not work for 0.5.2?

Bodhi

Hi,
I don´t know if it works with 0.5.2 simply because I didn´t try it yet,
I
just upgraded the rails version but still working on an old radiant
version.
Keith - errors like you get for not attaching a file can be easily taken
care of in the code, the code you´re using is more of an example then
anything else.
I´ll check the patch on 0.5.2 and send updates if needed.
Dror

Hi, I installed the patch yesterday against 0.5.2 and it seemed to
work just fine. Thanks, by the way, it looks like it should work
great.

-Tom

dror tirosh wrote:

Hi,
I don´t know if it works with 0.5.2 simply because I didn´t try it yet,
I
just upgraded the rails version but still working on an old radiant
version.
Keith - errors like you get for not attaching a file can be easily taken
care of in the code, the code you´re using is more of an example then
anything else.
I´ll check the patch on 0.5.2 and send updates if needed.
Dror

I figured this, but have been banging my head trying to get rid of that
particular error. Ruby and I are still getting to know one another.

I have everything else working and little remains of your code example,
but this one is vexing me. Pointers…?

Keith

Hey Keith,
Took a bit of time and it shouldn’t but I got this solution:
In the attahcment_part_type.rb, line 25 (might be a bit different in
yours),
change the condition to:
if params[:file] && (params[:file].original_filename.length > 0)

Dror

I also did a multiple upload in an asynch background page_part, whcih I
use
afterwards to show galleries.
This relies on the Rmagick package.
And a small change to the routes.rb file.

in your routes.rb add:
# Upload Routes
map.with_options(:controller => ‘admin/upload’) do |upload|
upload.index ‘upload’,
:action => ‘index’
upload.upload ‘upload/upload’,
:action => ‘upload’
end

put the upload_controller into app/controllers/admin
the multiple_upload_part_type into app/page_part_types (or whereever you
keep them)
and the view.rar open into app/views/admin
Hope I didn’t forget anything
Dror

dror tirosh wrote:

Hey Keith,
Took a bit of time and it shouldn’t but I got this solution:
In the attahcment_part_type.rb, line 25 (might be a bit different in
yours),
change the condition to:
if params[:file] && (params[:file].original_filename.length > 0)

Dror

Thanks, I will try that out.

Keith

dror tirosh wrote:

I also did a multiple upload in an asynch background page_part, whcih I
use
afterwards to show galleries.
This relies on the Rmagick package.
And a small change to the routes.rb file.

in your routes.rb add:
# Upload Routes
map.with_options(:controller => ‘admin/upload’) do |upload|
upload.index ‘upload’,
:action => ‘index’
upload.upload ‘upload/upload’,
:action => ‘upload’
end

put the upload_controller into app/controllers/admin
the multiple_upload_part_type into app/page_part_types (or whereever you
keep them)
and the view.rar open into app/views/admin
Hope I didn’t forget anything
Dror

A little late, but for some reason this does not work. The upload
indicator times out and then the images are not processed…

Keith B.

Sorry,
This is mainly for my own use, the script is only there for the
page_part_type, any actual page_part you use doesn’t have any script for
it.
But for most the code is pretty simple so you obviously figured it out
from
there.
Dror

Once again, answered my own question: the included scripts do not
make the thumb and large folders, these must be made or it breaks. It
is easy to change this. Other than that, this is pretty slick.

Keith B.

I never enocuntered this problem, and I do add or remove images quite a
lot.
We remove images by just taking them off the list at the top.
I’ld be interested to see your fix.

One thing that I have to admit makes me unhappy with the code at the
moment
is that it all goes to the same directory, I’ld like it to go to a
directory
tree similar to the slug, or something of the sort. I hope I’ld get that
done and then upload another copy of it.

Dror

I am still getting the validation problem whenever I add or remove
images. I am really not sure what is going on, but I think getting
some sleep and attacking it in the morning withour stress might help.

As for the folders, I built something like that with the normal
uploads. Each page has its own folder. With the galleries and
seperate controller, it is a bit more difficult, but shouldn’t be a
problem. I will see what I can do.

Another thing I would like to do, is display the images in the page
in the admin section. This shouldn’t be a technical problem, but a
design one. I am already showing the article images this way, so I
just need to figure out how to best present the thumbnails.

Keith

I do have one question: I would like to be able to add photos once
the gallery is started. You seem to have programmed that, but when I
upload a second photo, I get a validation error… I will eventually
track it down, but maybe you have already found the problem.

Dpn’t worry, I realize that this code is not quite done. I enjoy it
nonetheless and it has helped me a lot…

Keith

bodhi wrote:

Tom, this feature isn’t in Radiant (yet.) but there is a patch on trac
[1] that gets you most of the way there. I believe some other people
are working on a more streamlined solution, but it hasn’t been
mentioned on the mailing list in a little while, so I’m not sure what
is happening there.

Bodhi

[1] http://dev.radiantcms.org:9007/radiant/ticket/147 ignore the spam
:slight_smile:

Hi,

This ticket seems to be broken in Trac. Are the files/patches available
anywhere else?

Thanks,
Kev