Page 1 of 1
Problems with images on other disk (NAS)
Posted: 2011-03-01T02:09:51-07:00
by Vigour
Hi!
I have a problem when using ImageMagick, before I had both php files and all images on the same disk (my iMac web server)
And everything was working just fine.
Now I'm using a Netgear ReadyNAS Duo for storage of every image file.
The problem is that as soon as I have uploaded a file to the NAS I can't do any changes to the image with ImageMagick.
It works when it's on the same disk as the php file.
But I want to store them on a NAS and execute php scripts on a separate disk.
What can I do to solve this?
Thanks in advance for any help.
Re: Problems with images on other disk (NAS)
Posted: 2011-03-01T16:59:13-07:00
by anthony
ImageMagick only handles images using basic open and close of filehandles. As such it should perfectly find with NAS or any other 'mounted' file system when reading or writing normal image files.
The only aspect where this may be come a problem is for 'disk caching' when processing large files or intermediate MPC format (memory dump cache) files. These need the use of the memory mapping functions of the OS, and as may not work with NAS. As such your 'temporary' file usage should have this capability. You can direct this (away from "/tmp") using the MAGICK_TEMPORARY_PATH environment variable.
Re: Problems with images on other disk (NAS)
Posted: 2011-03-02T03:35:54-07:00
by Vigour
I am not sure if I understand you, this is completely new for me. Let me show you my code.
After the tif image is uploaded to my nas the following code is executed and nothing happens.
Code: Select all
$from_path = "ftp://xxx.xxx.xxx.xxx/image.tif";
$to_path = "ftp://xxx.xxx.xxx.xxx/image.jpg";
$exec = "/usr/local/bin/convert '$from_path' -units PixelsPerInch -density 72 -quality 60 '$to_path'";
exec($exec, $yaks);
The thing I want to do here is to take a tif image stored on the nas and make a jpg image and store that on the nas too.
Example:
xxx.xxx.xxx.xxx = Netgear ReadyNAS ip number
It works if I use the following path (from mac mini hd to mac mini hd):
$from_path = "image.tif";
$to_path = "image.jpg";
It also work if I use this path (from nas to mac mini hd):
$from_path = "
ftp://xxx.xxx.xxx.xxx/image.tif";
$to_path = "image.jpg";
But not if I do this (from nas to nas):
$from_path = "
ftp://xxx.xxx.xxx.xxx/image.tif";
$to_path = "
ftp://xxx.xxx.xxx.xxx/image.jpg";
The workaround is to only use the mac mini hd and after imagemagick have made the jpg image I upload it to the nas with ftp. This seems completely unnecessary.
Re: Problems with images on other disk (NAS)
Posted: 2011-03-02T18:33:30-07:00
by anthony
FTP (or HTTP) files are NOT mounted. They don't exist in the computers filesystem but are 'downloaded'.
IM will use "wget" to download images that are referenced as FTP or HTTP.
It will NOT upload to such URL's.
As such IM can not change a image stored on a FTP server (NAS or otherwise).
However you can write a special output 'delegate' script to upload the resulting image.
See IM Examples, File Handling, Delegates, Output
http://www.imagemagick.org/Usage/files/#delegate_output
Basically you create a program to upload to your NAS, say using a special "nas:" coder prefix, then tell IM about it.
Once such a delegate is created you can then use something like convert .... nas:image.png
to upload images to the nas.
Hmmm I think I'll like to make a similar coder to upload images to dropbox
I already have a program to upload a specified image file, just need to make a delegate wrapper
Re: Problems with images on other disk (NAS)
Posted: 2011-03-02T18:59:04-07:00
by anthony
Looking deeper. It does not look like delegates will work, as it looks like it is now restricted to format conversions. Delegates do not seem to be given the actual 'string' that the user has specified as a output destination.
As such uploading to a non-local site using delegates may not work either -- sorry.