I think that it would be greate if this module would have integration with 'File (Field) Paths' module. I mean that if we set some custom path with 'File (Field) Paths' for image - this module will use this path for generated images. I was trying to do it, but hasn`t gone far.. so asking you for it.

p.s. thanks for this module!

Comments

quicksketch’s picture

This module doesn't have any dependence on any path. It will take the original path and just preprend "resize/" to the front of it. So a file path like http://example.com/sites/all/files/articles/[uid]/[nid]/sample.png would be rewritten as http://example.com/sites/all/files/resize/articles/[uid]/[nid]/sample.png. So in that regard, Image Resize Filter already uses the paths as set by FileField Paths and other modules.

lanzs’s picture

Thanks for so fast answer!

Ok, I see. I just wanted to do so: if we use a 'filefield_path' module for storage an images in specific folders - simple upload created thumbs to these folders, e.g. if we set file path to '[type]/[nid]' - so created thumb will be stored in this folder too (not in 'resize/[type]/[nid]').
Maybe this feature is not so necessary, but I need it to be able keep all files in right places.

So, for this small feature I made this:

in module file (image_resize_filter.module) I have changed:
line 496
from

$local_file_path = 'resize/' . $local_file_dir . $path_info['filename'] . '-' . $image['expected_size']['width'] . 'x' . $image['expected_size']['height'] . '.' . $path_info['extension'];

to

$local_file_path = ( module_exists('filefield_paths') ? $local_file_dir . $path_info['filename'] . '-' . $image['expected_size']['width'] . 'x' . $image['expected_size']['height'] . '.' . $path_info['extension'] : 'resize/' . $local_file_dir . $path_info['filename'] . '-' . $image['expected_size']['width'] . 'x' . $image['expected_size']['height'] . '.' . $path_info['extension'] );

line 632
from

$directory = $file_directory_path . '/resize/' . $local_file_dir;

to

$directory = ( module_exists('filefield_paths') ? $file_directory_path . $local_file_dir : $file_directory_path . '/resize/' . $local_file_dir );

I don`t know, if its the right way or not, so if it is not - maybe you can give me some advice. Thanks!