Topic: autoGallery  (Read 15138 times)

Pages: [1] 2 3 ... 7   Go Down

#1: 22-Aug-2009, 06:57 PM


andrew4u
Posts: 31

I have not found a general Support/Comments topic regarding autoGallery I will start a new topic over here. (I hope it's ok)

I have had a good experience with this snippet and I have integrated it in my project. Unfortunately I have got one problem.

I have found out that automatic thumbnail generator is generating weird thumbs. Even though It does manage to resize and do what should the photos do look very flaky (fuzzy edges) and have a very big size if I take the photo quality into mind.

Example
--Original JPG (quality 60) has 200kB
--Thumb auto resized 20kB (but very bad quality)
--Thumb resized in Photoshop to the same size (quality 60) has 8kB

Is it a general problem of all the automatic resizing tool, that the quality and size are dismal? What compression algorithm is usually used?

Thanks for any suggestions!
Regards, Andrew
MODx is way ahead... Thanks for your work!

#2: 31-Aug-2009, 04:59 PM


andrew4u
Posts: 31

I have also not managed to find out in what order the photos are being output. It looks as if totally random order. I have tried to change names and date/time but it does not look as if it influences the order by any means. I ahve looked nito the code and the only part that could contain it should be this one:

Code:
$output = '';
while($entry = readdir($dir)) {
if(!(($entry == '..')||($entry == '.')||(substr($entry, 0, 3) == 'tn_'))) {
$path = $basepath . $mojeTV['value'] . '/' . $entry;
$params['imgpath'] = $path;
$filename = basename($path);
$params['filename'] = $filename;
$tnimgpath = $basepath . $mojeTV['value'] . '/tn_';
$tnimgpath = $tnimgpath . $filename;

Any thoughts? Thanks a lot!
MODx is way ahead... Thanks for your work!

#3: 31-Aug-2009, 05:11 PM


ramsay
Posts: 78

WWW
Hi!

Sorry, I should watch this forum a bit more closely! Your email poked me into life though...

AutoGallery was released a bit before it was really cleanly developed because I thought it might be handy to people that needed a similarly quick and dirty solution. I am working on a better version that I'll put up soon.

Regarding picture ordering I think it is ordered in whatever way the filesystem orders the files... Its alphabetical on our Fedora Linux server, so 01file comes before 1file comes before file comes before guile, etc. Ordering is definitely something I have added to the better version!

Regarding resizing: there were some odd decisions taken about resizing - and, especially, cropping. I do the technical backed stuff and my mate does all the front-side, visual, humanities student stuff (  Wink )  so I coded what he wants. I seem to remember that it forces things towards portrait format, so if you enter a width and a height it will crop the sides and stretch the top and bottom, even if the opposite would make far more sense. This could explain your dodgy quality? Alternately it could be really dodgy coding Wink

If you can point me to your site and give me any more details (on email if you'd prefer) I'd be happy to help. Although its 23:11 in the UK so it will be tomorrow...


Ramsay


#4: 31-Aug-2009, 05:14 PM


ramsay
Posts: 78

WWW
As a brief extra note: they thumbnails are build with "quality: 100" but thats the JPEG compression argument, so it explains the huge file size despite poor quality. Its probably an unfortunate interaction with the cropping thats causing your troubles.


Ramsay

#5: 31-Aug-2009, 05:39 PM


andrew4u
Posts: 31

Thanks a ton for your input! Cool

As for the image quality I have prepared a few samples.
tn_slokoa6.jpg (resized by the script) (Picture info - CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 100)
tn_slokoa6_ps.jpg (resized by Photoshop Q-100)
tn_slokoa6_ps_q60.jpg (resized by Photoshop Q-60)

The output by the script and the PS at q100 have the same size. That makes it certain that the compression is similar. Both have listed a compression ratio of 1.9 ... just the quality is different. (check the attachments)

To get around the big size it would be posible to change the code in the snippet line:
imagejpeg($targetimg, $tnimgpath, 100);
changing the 100 to 60 or lower if I am not mistaken.


As with the ordering I have encountered wierd ordering on the provider's Linux box (don't know the exact file system that is used). I have tried different namings as well as the 0001-00xx but without success. I will send you a link to the gallery on your email.

Thanks again for your work and a good light snippet Wink Its past midnight here as well so I am moving to bed as well.. Good night!


* tn_slokoa6.jpg (30.26 KB, 160x120 - viewed 230 times.)

* tn_slokoa6_ps.jpg (29.57 KB, 160x120 - viewed 217 times.)

* tn_slokoa6_ps_q60.jpg (9.88 KB, 160x120 - viewed 214 times.)
« Last Edit: 31-Aug-2009, 05:47 PM by andrew4u »
MODx is way ahead... Thanks for your work!

#6: 1-Sep-2009, 04:05 AM


ramsay
Posts: 78

WWW
Thats certainly the right line if you want to change the quality; I'll make it an optional argument to the better version.

It will be using whatever JPEG library is built in to your PHP install, so it will probably never compare to a shiny professional tool like Photoshop. Unfortunately those electrical cabinets contain lots of very small straight lines, which I would have expected to be tricky for anything but the best image resizing tool. Maybe I can reorder the resizing somehow; it could be that resizing then resampling would be better. Or something. Suggestions from the gallery (no pun intended) welcome! Wink

I'll have a look today and try to release a better version of autoGallery. I've been meaning to revisit it for a while, so this is a good excuse.


Ramsay

#7: 1-Sep-2009, 04:59 AM

Support Subscriber

Lizard
Posts: 294

Hi .. This gall was also designed initially to work with quite large thumbs (width 300 I think) which it works better with and was designed with a very specific site in mind, on which it worked well, however, as Ramsay has pointed out it has been quite updated since then! I think its time Ramsay and myself got together packaged it properly documented it and released it into the wild!

We have also integrated it now with Audio and Video playback and also Greybox
Everytime you use Flash ... a puppy dies .....
R.G Taylor

#8: 1-Sep-2009, 06:16 AM


andrew4u
Posts: 31

Thanks for you comments! Really appreciated them..

I have managed to get around the thumb creation.. setting Q to 50 makes the size small and the quality issues are minor for me at the moment. In the end I can always repair it via Photoshop.

The only issue that is pretty important for me now is the ordering :-D I got stuck on this I am really puzzled how to make it order 0001->1000 oh lord Smiley

Will your new version suppply some ordering options? Thanks a lot for your work!

Btw I am also using folder names via a TV (not the doc ID as by default)
Code:
$mojeTV = $modx->getTemplateVar('autogallery_folder', '*', $modx->documentIdentifier);
$dir = opendir($basepath . $mojeTV['value']);
Just a little suggestion for implemetation Smiley

Thanks and looking forward for your new version!
MODx is way ahead... Thanks for your work!

#9: 1-Sep-2009, 08:27 AM


ramsay
Posts: 78

WWW
The quick and dirty way to do ordering is to replace:


Code:
$dir = opendir($basepath . $modx->documentIdentifier);

$output = '';
while($entry = readdir($dir)) {
if(!(($entry == '..')||($entry == '.')||(substr($entry, 0, 3) == 'tn_'))) {

with:



Code:
$dir = opendir($basepath . $docId);

$output = '';
$filelist = array();
while($entry = readdir($dir)) {
  if(!(($entry == '..')||($entry == '.')||(substr($entry, 0, 3) == 'tn_'))) {
    array_push($filelist, $entry);
  }
}

sort($filelist);

foreach($filelist as $entry) {

I'll try to make it a bit cleverer in the new version but thats working ok for me now. You can probably do clever things with the php sort command, it takes a second argument: http://us.php.net/manual/en/function.sort.php



Ramsay

#10: 1-Sep-2009, 02:16 PM


andrew4u
Posts: 31

Thanks for the sorting code! Looks good to go Smiley
MODx is way ahead... Thanks for your work!

#11: 1-Sep-2009, 02:48 PM


ramsay
Posts: 78

WWW
For the 217 other people that have viewed this thread: AutoGallery 2.0 is now with beta testers. Should be able to put it up later in the week.

It now has support for flv and mp3 files - in that it will prefix their URLs with a defined string, so you can play them with a player.
The code is less of a mess so I should be able to add things quickly, and other people might not think so little of me when they read it.
It supports a quality argument for the tn generator.

Ramsay

#12: 1-Sep-2009, 03:07 PM


andrew4u
Posts: 31

With the old version I have also figured one little thing. FCKeditor creates thumbnails of images with a name .thumb_**** (****=name of the image). Would it be possible to omit showing+"tn creation" of these files on the particular directory?
MODx is way ahead... Thanks for your work!

#13: 1-Sep-2009, 03:42 PM


ramsay
Posts: 78

WWW
What I ought to have done is excluded all files that start with a dot! That would be a more sensible UNIX approach, wouldn't it? Wink

#14: 1-Sep-2009, 04:53 PM


andrew4u
Posts: 31

What I ought to have done is excluded all files that start with a dot! That would be a more sensible UNIX approach, wouldn't it? Wink

 Grin Hit the nail on the head..
MODx is way ahead... Thanks for your work!

#15: 1-Sep-2009, 05:26 PM


andrew4u
Posts: 31

What I ought to have done is excluded all files that start with a dot! That would be a more sensible UNIX approach, wouldn't it? Wink

Thanks for pointing me there... got it now working:

Code:
if(!(($entry == '..')||($entry == '.')||($entry[0] == '.')||(substr($entry, 0, 3) == 'tn_'))) {
MODx is way ahead... Thanks for your work!

#16: 2-Sep-2009, 03:18 AM


ramsay
Posts: 78

WWW
Ok, I feel slightly daft because I put:
Code:
(substr($entry, 0, 1) != '.')

Wink

But you left in the bits that test for '.' and '..' that are now redundant, so I think we are even  Grin

This will be in the released version. This will wind up the one guy who WANTS to show files beginning with dots...



Ramsay

#17: 2-Sep-2009, 10:21 AM

onivan
Posts: 1

Hello!

How can I make that the thumbnails will be arranged by rows and columns?

I'm nub with modx.

Thanx!

#18: 3-Sep-2009, 02:59 AM


ramsay
Posts: 78

WWW
Martyn does the front side visual stuff, I don't really understand it Smiley

I think he does it by putting each item in a span of a fixed width then putting the snippet call in a div of a fixed width that is an exact multiple of the span width, so they wrap round after exactly N items and line up nicely.

AutoGallery doesn't support output in tables. Martyn wouldn't let me Wink

« Last Edit: 3-Sep-2009, 05:33 AM by ramsay »

#19: 3-Sep-2009, 03:28 AM

Support Subscriber

Lizard
Posts: 294

hehe@ramsay

ok in the chunk .. just put everything inside a fixed width and hieght span that is floated left ....
Thats how i normally do it, you can set margins etc to get your gris effect.

Cheers
Martyn
Everytime you use Flash ... a puppy dies .....
R.G Taylor

#20: 8-Sep-2009, 05:31 AM


janice171
Posts: 218

WWW
Hi,

i'd like to test out this snippet but i'm struggling at stage 1...could someone give me an example of how the chunk would be written using the placeholders?

My html will something like this...

<div id="left-main-image">
    <img src="#" alt="#" />
</div>                 
<div id="right-gallery"> 
<div class="right-gallery-thumbs">   
         <a href="#" title="#"/><img src="#" alt="#" /></a>
</div>
</div>


Thanks

J


www.9thwavedesign.co.uk
   WEB | DESIGN | PRINT
Pages: [1] 2 3 ... 7   Go Up
0 Members and 1 Guest are viewing this topic.