allow absolute file names in vipsthumbnail -o
thanks fuho
This commit is contained in:
parent
40fd51d165
commit
767bfc3b7f
@ -19,6 +19,7 @@
|
|||||||
- update for new glib threading API
|
- update for new glib threading API
|
||||||
- remove no threads option, glib no longer support it
|
- remove no threads option, glib no longer support it
|
||||||
- better --help output for vips driver prog
|
- better --help output for vips driver prog
|
||||||
|
- vipsthumbnail -o allows absolute file names
|
||||||
|
|
||||||
2/10/12 started 7.30.4
|
2/10/12 started 7.30.4
|
||||||
- remove options from format string in .dzi (thanks Martin)
|
- remove options from format string in .dzi (thanks Martin)
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
* - remove "--nodelete" option, have a --delete option instead, off by
|
* - remove "--nodelete" option, have a --delete option instead, off by
|
||||||
* default
|
* default
|
||||||
* - much more gentle extra sharpening
|
* - much more gentle extra sharpening
|
||||||
|
* 13/11/12
|
||||||
|
* - allow absolute paths in -o (thanks fuho)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -306,25 +308,35 @@ thumbnail3( IMAGE *in, IMAGE *out )
|
|||||||
static char *
|
static char *
|
||||||
make_thumbnail_name( const char *filename )
|
make_thumbnail_name( const char *filename )
|
||||||
{
|
{
|
||||||
char *dir;
|
|
||||||
char *file;
|
char *file;
|
||||||
char *p;
|
char *p;
|
||||||
char buf[FILENAME_MAX];
|
char buf[FILENAME_MAX];
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
dir = g_path_get_dirname( filename );
|
|
||||||
file = g_path_get_basename( filename );
|
file = g_path_get_basename( filename );
|
||||||
|
|
||||||
|
/* Remove the suffix from the file portion.
|
||||||
|
*/
|
||||||
if( (p = strrchr( file, '.' )) )
|
if( (p = strrchr( file, '.' )) )
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
|
/* output_format can be an absolute path, in which case we discard the
|
||||||
|
* path from the incoming file.
|
||||||
|
*/
|
||||||
im_snprintf( buf, FILENAME_MAX, output_format, file );
|
im_snprintf( buf, FILENAME_MAX, output_format, file );
|
||||||
result = g_build_filename( dir, buf, NULL );
|
if( g_path_is_absolute( output_format ) )
|
||||||
|
result = g_strdup( buf );
|
||||||
|
else {
|
||||||
|
char *dir;
|
||||||
|
|
||||||
|
dir = g_path_get_dirname( filename );
|
||||||
|
result = g_build_filename( dir, buf, NULL );
|
||||||
|
g_free( dir );
|
||||||
|
}
|
||||||
|
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( "thumbnailing %s as %s\n", filename, buf );
|
printf( "thumbnailing %s as %s\n", filename, result );
|
||||||
|
|
||||||
g_free( dir );
|
|
||||||
g_free( file );
|
g_free( file );
|
||||||
|
|
||||||
return( result );
|
return( result );
|
||||||
|
Loading…
Reference in New Issue
Block a user