Skip to main content
Inspiring
February 23, 2009
Question

CFImage writing function

  • February 23, 2009
  • 11 replies
  • 1164 views
When I try to write a file to a directory it asks me to verify if CF has rights to perform that operation. So my program breaks. This should not be a hard one. Any thoughts?

Thanks!
This topic has been closed for replies.

11 replies

Inspiring
February 24, 2009
Azadi,

Thank you! You did not guess wrong. I thought there was a way to tell teh source attribute to automatically pick up the directory the image was coming from. Fair enough. That's all I needed to know.

Thanks again!

Ysais.
Inspiring
February 24, 2009
Thanks Ian!

I will check all my permissions and such on CF Admin. All my servers are Windows except one that we use to test some functionality. I will post on here how I make out with this situation.

Thanks!

Ysais.
Inspiring
February 24, 2009
apocalipsis19 wrote:
> Because I want to select images from anywhere in
> my network.
>

hmm... how do you expect <cfimage> to *guess* where exactly it should
get the image from? :)
there's no way cf can 'guess' where myimage.gif is located - that's what
the SOURCE attribute is for: to tell it where to fetch the image from.
by default it will look in the same location the page with <cfimage> tag
is located in. that's why SOURCE is a REQUIRED attribute.

or do you mean that your same codebase on different servers should be
accessing a different, server-specific, images location?

you could set an application-scope var...
or maybe better just create a cf mapping to the location of your images...
and use that as SOURCE value

sorry if i still have guessed your question wrong - maybe you should try
to explain your network setup and how and where your application runs a
bit more...


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Inspiring
February 24, 2009
apocalipsis19 wrote:
> I can select an image from anywhere in my network?

The default install of ColdFusion usually only has permissions to read
and write to directories on the server on which it is installed.

If you want it to have permissions to resources on other servers you
have to configure it to run as a user that has those permissions. How
you do this depends on whether you are using Windows or Unix servers.

Inspiring
February 24, 2009
I always check the docs and by the way they SUCK. That being said, thank you for your response but I know that already. I have 8 servers in my network and as of now, I have to specify the path in my code of where the image is coming from (SOURCE). I want to make my program that the image is read by CFIMage regardless of the location of the picture. So far I have to code EVERYWHERE where my source file is: source="//webdata/development/webimages/image.jpg" I dont want to havr to do that! Because I want to select images from anywhere in my network.
Inspiring
February 24, 2009
when in doubt - check the docs!

from <cfimage> cfml reference:

source = "absolute pathname|pathname relative to the web
root|URL|#cfimage variable#"

- URL of the source image; for example,
" http://www.google.com/images/logo.gif"
- Absolute pathname or a pathname relative to the web root;
for example: "c:\images\logo.jpg"
- ColdFusion image variable containing another image, BLOB,
or byte array; for example, "#myImage#"
- Base64 string; for example,
"data:image/jpg;base64,/9j/4AAQSkZJRgABAQA.............."


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Inspiring
February 24, 2009
Another way to put my question is: DO I always have to specify the source directory of my picture or I can select an image from anywhere in my network?
Inspiring
February 24, 2009
I solved that issue already. Thanks.

I am using CFImage. The problem now is my source file. My program only lets me select image files from the same location where my cfm files are. If I upload a file let's say from my pictures, the program breaks and it says that it can't find the file in location: location_where_cfm_files_are_located. So it only lets me pick images that are in the same folder as my CFM files.
Inspiring
February 23, 2009
I solved this issue. Now what about when the source of your image is random? I need to upload images from multiple locations not just the local directory where the cfm files reside.
Inspiring
February 24, 2009
So what was the issue?

apocalipsis19 wrote:
> I need to upload images from multiple locations not just the local directory where the cfm files reside.

I assume you mean use cffile to upload files to different locations? Just change the "destination" path to point to the desired directory. The same applies if you are using cfimage. You just change the "destination" path.

<cfimage
action="write"
source="#sourceImageOrPath#"
destination="c:\some\Other\Folder\someImage.png"
...
>

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_i_02.html


Inspiring
February 23, 2009
And how do you verify if CF has permission to write in that directory?