media_cache/commit

Cleaned code, added the option to fit images to a certain size.

authorChris Dijkshoorn
Fri Jun 21 15:24:42 2013 +0200
committerChris Dijkshoorn
Fri Jun 21 15:24:42 2013 +0200
commit7f01171de576a489af264bead7c421707de36757
tree42b150618c09b2f2e71c7cd2600c26c1360535ea
parente38e44fe7013b6ede7c7b867f2207ef88d877779
Diff style: patch stat
diff --git a/api/media_caching.pl b/api/media_caching.pl
index 50b7c7e..b1df1ab 100644
--- a/api/media_caching.pl
+++ b/api/media_caching.pl
@@ -43,8 +43,8 @@ do_http_thumbnail(Size, Request) :-
         uri_thumbnail(URI, ThumbnailFile, Size),
         http_reply_file(ThumbnailFile, [unsafe(true)], Request).
 
-/* http_pan_scan(+Request)
-* provides a pan and scanned version of the image fitting given dimensions
+/* http_fit_thumbnail(+Request)
+* provides a fitted version of the image adhering given dimensions
 */
 http_fit_thumbnail(Request)  :- do_http_fit(thumbnail_size, Request).
 http_medium_fit(Request)  :- do_http_fit(medium_size, Request).
diff --git a/lib/thumbnail.pl b/lib/thumbnail.pl
index 639af50..5aa3077 100644
--- a/lib/thumbnail.pl
+++ b/lib/thumbnail.pl
@@ -36,9 +36,9 @@
 % Windows: 'cmd.exe /C convert.exe'
 :- setting(convert_program, atom, convert,
 	   'ImageMagic convert used to create thumbnails').
-:- setting(thumbnail_size, any, size(350,300),
+:- setting(thumbnail_size, any, size(105,105),
 	   'Term size(W,H) into which thumbnails are scaled').
-:- setting(medium_size, any, size(1280,1024),
+:- setting(medium_size, any, size(800,800),
 	   'Term size(W,H) into which medium sizes are scaled').
 :- setting(cache_directory, atom, 'cache/thumbnails',
 	   'Directory for caching thumbnails').
@@ -63,9 +63,9 @@ uri_thumbnail(URI, File, Size) :-
 	    make_thumbnail(URI, File, Size)
 	).
 
-%%	uri_pan_scan(+URI, -File)
+%%	uri_fit_thumbnail(+URI, -File)
 %
-%       Return the panned and scanned for image at URI
+%       Return the fitted thumbnail for image at URI
 %
 %	TBD: Error recovery
 
@@ -123,9 +123,9 @@ scale(Full, File, Size) :-
 	;   format(user_error, 'FAILED: ~w', [Cmd])
 	).
 
-%%	make_pan_scan(+URI, +File) is det.
+%%	make_fit(+URI, +File) is det.
 %
-%	Create a panscan for an image located at URI in the file
+%	Create a fitted image located at URI in the file
 %	File.
 make_fit(URI, File, Size) :-
 	local_file_for_uri(URI, Full), !,