Page 1 of 1

Client wants to upload/update images on site

Posted: Tue Jul 31, 2007 1:42 pm
by gavinhowells
Hello,

A client of mine wants to be able to update and modify images on pages of his site on a regular basis. This is turning out to be more difficult than originally thought.

To my knowledge the current way of loading images is using the {image src="something.jpg"} tag in the template itself but this isn't very practical if the client wants to add a new page using the same template but use a different image.

At first I messed around with using content blocks and used this

Code: Select all

<img src="images/{content block='image name to be entered here' oneline='true'}.jpg" />
This would produce a text box underneath the 'content' box in the cms called 'image name to be entered here'. All anyone would need to do is fill EXACTLY the name of image they had uploaded into the image library. Up until now this had been acceptable however my client feels this method  is too complicated.

So, is there any other way of handling images so the client can update and modify whenever they see fit?

Is there anyway of modifying the cms so that you can upload an image from the content page, and assign that image to that page? For example (quick photoshop pic)

Image

or, instead of having a text box where you put in the name, there is a drop down that lists all the files in the image manager?

???

I know its the longest of shots, but thought some people may have ideas.

Cheers

Gavin

Re: Client wants to upload/update images on site

Posted: Tue Jul 31, 2007 1:49 pm
by calguy1000
Currently there's no way to do this in the content manager.  In 2.0 we're planning to implement block types which would allow you to do exactly what you need, but we're not there yet.

Re: Client wants to upload/update images on site

Posted: Tue Jul 31, 2007 1:53 pm
by gavinhowells
Thanks for the reply calguy! Much appreciated.  :)

At least I know...

Re: Client wants to upload/update images on site

Posted: Tue Jul 31, 2007 2:00 pm
by RonnyK
If you use TinyMCE there is a button "Insert/Edit image" (the tree), that can be used to browse for images inside the uploads folder, by using the "Browse"-button. If the image is to be transferred to the server, you can use the next "browse"-button to browse for images on the client-machine, after which it is uploaded and possible to show on the page.

SO both browsing on the server as uploading is possible from the editor. Make sure that umask is set to "002" in global settings, to be able to view other peoples images.

Ronny

Re: Client wants to upload/update images on site

Posted: Tue Jul 31, 2007 4:55 pm
by chrisl
You could try

http://forum.cmsmadesimple.org/index.ph ... l#msg63696

but perhaps this might be too radical an approach

Re: Client wants to upload/update images on site

Posted: Wed Aug 01, 2007 1:23 pm
by gavinhowells
Hmmm. *scratches head* I'd never considered creating a content block and using the text box soley as a means of loading an image into. It seems so simple when you think about it  ;D Also using the mods Clorne suggested has resulted in a not to shabby way of dealing with the situation.....at least until V2 comes along!!

Cheers guys!!

Re: Client wants to upload/update images on site

Posted: Wed Aug 01, 2007 2:05 pm
by faglork
Hello all,

another quick-and-dirty solution:

Write an UDT wich just gets the page's alias and use it to construct an image URL:

Code: Select all

global $gCms;
$picname =& $gCms->variables['page_name'];

$filename = '/www/123/html/uploads/images/pix/'.$picname.'.jpg';

if (file_exists($filename)) {
    echo "<img src=\"/uploads/images/pix/$picname.jpg\" class=\"someclass\" alt=\"some alt text if appropriate\" title=\"some title here\" />";
} else {
    echo "<p>(currently no pic available)</p>";
}
Give the UDT a name like autoinmage and call it in the template with

Code: Select all

{autoimage}
That way, you
- just make a new page
- upload  images with the same name as the corresponding page's alias.

Did that for a client who had to add images to to about 300 pages ... worked like a charm. We just uploaded 300 files (which had been given proper names) per ftp - that was all.

HTH,
Alex