Problems with images on other disk (NAS)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Vigour
Posts: 6
Joined: 2011-02-27T03:06:01-07:00
Authentication code: 8675308

Problems with images on other disk (NAS)

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problems with images on other disk (NAS)

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Vigour
Posts: 6
Joined: 2011-02-27T03:06:01-07:00
Authentication code: 8675308

Re: Problems with images on other disk (NAS)

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problems with images on other disk (NAS)

Post 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 :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problems with images on other disk (NAS)

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply