from
Generate HTML Table with thumbnails from jpg images
by Theodoros Giannakopoulos
Creates an html table that contains the thumbnails (and links) of the jpg images of a whole director
|
| resizeImageDir(DirName,DirName2,newName,preferredW)
|
function resizeImageDir(DirName,DirName2,newName,preferredW)
% function for resizing the jpeg files stored in a directory:
% DirName: the folder in which the images are stored.
% DirName2: the folder in which the thumbnails will be stored.
% newName: a string to be added in front of all fileNames for the thumbnail
% files
% preferredW: preferred width of the thumbnails
D = dir([DirName '/*.jpg']);
warning off;
count = 1;
for (i=3:length(D))
fprintf('Processing file %s...',D(i).name);
%resizeJPG(sprintf('%s\\%s.jpg',DirName,D(i).name(1:end-4)),sprintf('%s\\%s%d.jpg',DirName,newName,count),1);
if (strcmp(newName,'')~=1)
newFileName = [DirName '/' DirName2 '/' newName D(i).name(1:end-4) '.jpg'];
else % replace:
newFileName = [DirName '/' DirName2 '/' D(i).name(1:end-4) '.jpg'];
end
resizeJPG(sprintf('%s/%s.jpg',DirName,D(i).name(1:end-4)),newFileName,preferredW);
fprintf('\n');
count = count + 1;
end
|
|
Contact us at files@mathworks.com