Hello,

I'm writing a script-fu for use in my office.  The idea is to reduce the 
amount of steps the user needs to take in order to save an acquired 
screenshot to our website.
*
*The problem I am having is that I cannot seem to save a file to an 
smb:// type address.   This is the error I get when testing:

*[error]
*Could not open 'smb://ldad_images/screenshots/web-image.png' for writing: No 
such file or directory
Error while executing
(script-fu-Send-to-Web 1 "smb://ldad_images/screenshots/" "web-image.png")
ERROR: Procedural database execution failed:
    (file_png_save2 1 1 5 "smb://ldad_images/screenshots/web-image.png" 
"web-image.png" 1 9 0 0 0 1 1 0 0)
*[/error]*


The script works just fine if I save the image to a local drive such as 
'/tmp/'.

Also, if I type this in a terminal:

nautilus smb://ldad_images/screenshots/

A file browser opens just fine into the shared 'screenshots' directory.

If saving to a network drive is not possible (such as smb://), is there 
some other trick I could use to get the image over there? 

Suggestions would be helpful :-)


Here's the code I have thus far:

*[code]
*(define 
        (script-fu-Send-to-Web Image Location Filename)
        
        ; the directory our file will be saved in
        (set! SRCFilename (string-append Location Filename))
        
        ; scale the image to our optimum web size
        (set! width (car (gimp-image-width Image)))
        (set! height (car (gimp-image-height Image)))
        (if (> width 470)
                (begin
                        (set! newHeight (/ (* 470 height) width))
                        (gimp-image-scale Image 470 newHeight)
                        (gimp-displays-flush)
                )
        )
        
        ; add a drop shadow
        (set! drawable (car (gimp-image-get-active-drawable Image)))
        (script-fu-drop-shadow Image drawable 8.0 8.0 15.0 '(0 0 0) 80.0 TRUE)
        (gimp-displays-flush)
        
        ; save as png file to our www directory on ldad (or wherever the user 
indicated)
        (gimp-image-merge-visible-layers Image 0)
        (gimp-displays-flush)
        (set! drawable (car (gimp-image-get-active-drawable Image)))
        (file-png-save2 RUN-NONINTERACTIVE Image drawable SRCFilename Filename 
1 9 0 0 0 1 1 0 0)
        (gimp-displays-flush)
        
        ; Close out the image
        (gimp-display-delete Image)
        
        ; Let user know it's online
        (gimp-message "Cool!  Your picture is online.  You may now include it 
in a 'Top News of the Day' article.")
)

; Register the function with the GIMP:
(script-fu-register
    "script-fu-Send-to-Web"
    "<Toolbox>/NWS/Send To Web"
    "Scales the image to 500px width and saves it to www images rsync directory 
on LDAD."
    "Tony Freeman"
    "2007, National Weather Service, Louisville"
    "March 06, 2007"
    "RGB* GRAY*"
    SF-IMAGE    "The Image"     0
    SF-STRING   "Location"      "smb://ldad_images/screenshots/"
    SF-STRING   "File Name"     "web-image.png"
)*
**[/code]*

_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Reply via email to