Problems, need help? Have a tip or advice? Post it here.
10 posts Page 1 of 1
I want to change the 'default' location for images and browsing for existing images.

I want to change this to a folder from the root of the site /images.

Added: define( 'K_UPLOAD_DIR', 'images' );

When looking for an image it tries to access a folder called /images/image/ ??

This is not what I want - I want to access the folder website.com/images and NOT website.com/images/image

I understood that the k_upload_dir would allow me to change the 'path' to uploads and images?

As it stands I have to upload the 'same' image that is sitting in /images to a folder called /images/image

Help please...
Hi,

'K_UPLOAD_DIR' is meant to hold all kinds of uploads - which includes not only images but also files (and securefile attachments etc.).
So, whatever location you specify here would automatically get a separate folder within it for each upload type - 'image' for images and 'file' for files etc.

So, if you were to specify, for example, 'assets' here, the path for the images would become 'assets/image/' and 'assets/file/' for files.

I'd suggest you please use that kind of a name (uploads, assets etc.) that pertain to all uploaded files in general.
I am sorry, we cannot change the location only one kind of uploads e.g. images in your case.
Thanks for the reply.

My issue is that the site we are converting to Couch already has images on pages located in the images folder and subfolders. Seems a waste of time to re-upload all the same images again because the folder structure has changed.

So, how do I get the file manager to show the folder of 'images' when opening the folder browser so that we do not have to upload the same image into another folder - and create duplicate images?

Hope that makes sense. Eg. existing web pages with existing images that are all located in images folder from root (/images)

Cheers
I would suggest a quick dirty trick, but be warned, though you will not have to re-upload the images but will have to locate the path of the image from the couch admin panel (where ever you are to display the image).

Move the "images" from your images folder to the newly defined upload directory "image"

And then when "folder browser" (as you said) you will find all your existing images there (that you moved).

Regards,
GenXCoders
Image
where innovation meets technology
Thanks for that, kind of thought that would work...

Issue is that all the existing pages that point to images in the images folder would not work - e.g. having 'moved' the imatges all the existing pages that have images would break... Arrrrhhhhh!

Nightmare. Surely it would be far easier for the guys to allow us to just point to the correct location where all the images are located...? The system is supposed to be for retro-fitting static pages into a sort of CMS system. Without being able to point the existing pages at the location where the current images are located it means you have to go into every page and manually re-point the images to another location or.... re-upload all the images and create duplicates.

Surely there is an easy answer...?
@Jonathan,

While I agree that it would be nice to make the explorer point to any arbitrary location, for now this is not available and so we'll have to make do with whatever is.

That said, I haven't found this much of a bother really because normally there are two types of images in an existing static site -
1. That constitute the site's design (background etc.) and are normally not required to be changed by the site owner.
2. Those that are meant to be uploaded/updated by the site owner.

The first type are not made Couch managed so you can leave them at the original location and they'll continue to work as before even after Couch is added to the site,

It is only the second type that are converted into Couch managed editable regions (type 'image') that will need change.

Once you add an editable region to <IMG> tag, you'll anyway need go to the admin panel and select an image into the region.
In the design phase, a developer normally needs to work with only 'seeding' a few pages so it is only a small number of edits. Once the site goes live, the client keeps on uploading images and they all go to the location recognized by Couch.

Point is, it does not appear to be a big deal to move the existing images that will be Couch managed to the new location - the ones which are not can stay where they are.
\
I guess the issue is that as I am having an issue (!) there must be others also having the issue and for such a simple fix...

I agree with a new site - NOT a problem. With an existing site with 100's of pages with images already uploaded an on pages, but giving the user the ability to change those images - A MAJOR PROBLEM.

e.g. As soon as you give the user the ability to change the image (standard practice these days), and you make that image editable, bang! you lose the image on that page (and 100's of others). The user then has to:

    1. go and remember what image that was
    2. re-upload the image (which, of course is already on the server) and then
    3. finally save the page.

So is it a problem - YES! as a developer of over 35 years it seems a bit dismissal to say to a client

"Oh, yes sorry you have to go through each of your 100+ pages of existing content (that you already had images on...) and re-upload the 'same' image that was already there(!) on every page and re-save that page"...


Not sure how that would go down!!
I feel your pain :) Solve this issue rather at the expense of disk space not your well-being.
@Jonathan
as I already conceded, it would be nice to have the explorer point to any arbitrary location.
However, I'll have to disagree with your observation -
With an existing site with 100's of pages with images already uploaded an on pages, but giving the user the ability to change those images - A MAJOR PROBLEM.

e.g. As soon as you give the user the ability to change the image (standard practice these days), and you make that image editable, bang! you lose the image on that page (and 100's of others).

Since we are discussing existing pages (and 100s of them), as I see it, the only practical way to Couchify them while automatically importing existing data would be to convert each of the page into a template (i,e. add the two PHP statements you are aware of).

We cannot use the cloned-pages route as that would in any case entail recreating each page manually in the admin-panel and inputting data (which would include the images - so it wouldn't really matter where the images are located as you'll have to select and input them nevertheless).

So, continuing with the assumption that you are converting an existing page into a Couch template suppose the page has the following image -
Code: Select all
<img src="assets/img/people/joe.jpg" />

As you can see, the image is not residing in the location that Couch would eventually use.

OK, so now to make the image editable so as to allow the user to change it, use the following -
Code: Select all
<img src="<cms:editable name='my_image' type='image'>assets/img/people/joe.jpg</cms:editable>" />

By enclosing existing data within the cms:editable tags, we are making that data the default value for the region.

So now when you come back to the admin-panel, you'll see that the image editable region is showing your original path (but the client can now select into it a new image).

On the frontend, the original image will continue showing the way it did before although now it is editable.

So is it a problem - YES! as a developer of over 35 years it seems a bit dismissal to say to a client

"Oh, yes sorry you have to go through each of your 100+ pages of existing content (that you already had images on...) and re-upload the 'same' image that was already there(!) on every page and re-save that page"...

As I have shown above, that is most certainly not that you'll need to say.
Rather, you say "Your page keeps looking exactly the way it did before. To use a new image, upload one from your machine and select it".

So wrapping up the discussion -
if your problem was that making a region editable will make the design lose the existing image and the client will have to re-upload them, that is a non-issue.

However, if your intention was that to select a new image the client could browse through a set of images already existing on the server (and not have to upload themselves) - that would still be a problem I am afraid.

The only resolution in that case would be, as @trendoman suggested, to forgo some disk space and FTP the images to the new location.
Ahhh perfect - hadn't realised that you could 'seed' the image link with the existing link!!

If that was laid out in the docs (perhaps it is?) really clearly it would of saved me a lot of time and some stupid emails.

Thanks again for getting back.

Cheers
Jonathan
10 posts Page 1 of 1