Before i make some complain. Gallery is great ;-)
There are some calls in gallery which are not nessarcy.
good example 1.4.3
Album classe file:
function getPhotoId($index) {
$photo = $this->getPhoto($index);
return $photo->getPhotoId($this->getAlbumDirURL("full"));
}
Albumitem class file:
function getPhotoId($dir) {
if ($this->image) {
return $this->image->getId($dir);
} else {
return "unknown";
}
}
Image class file:
function getId($dir) {
return $this->name;
}
As you can see the argument made in album is pointless.
I made a smart mirror system which does a lot in getAlbumDirURL().
Don't say "full" if you only need a number or something like that. I believe that you should only call the methode with a argument when you really intent to show the picture. Else my mirror engine does not what is going on.
In my version I changed some code to "real_full"
All methode like this need to be checked.
I volunteer for this job.
Posts: 13451
adventure, i'll forward this to the developers. BUT, you really should pop into IRC #gallery on freenode.net - I'm sure you will be very welcome!!
Posts: 2322
function getAlbumDirURL($type) { global $gallery; if (!empty($this->transient->mirrorUrl)) { return $this->transient->mirrorUrl; } $albumPath = "/".urlencode ($this->fields['name']); /* * Highlights are typically shown for many albums at once, * and it's slow to check each different album just for one * image. Highlights are also typically pretty small. So, * if this is for a highlight, don't mirror it. */ if ($gallery->app->feature["mirror"] && strcmp($type, "highlight")) { foreach(split("[[:space:]]+", $gallery->app->mirrorSites) as $base_url) { $base_url .= $albumPath; $serial = $base_url . "/serial.{$this->fields['serial_number']}.dat"; /* Don't use fs_fopen here since we're opening a url */ if ($fd = @fopen($serial, "r")) { $serialContents = fgets($fd, strlen($this->tsilb)+1); if (!strcmp($serialContents, $this->tsilb)) { $this->transient->mirrorUrl = $base_url; return $this->transient->mirrorUrl; } } } /* All mirrors are out of date */ $this->transient->mirrorUrl = $gallery->app->albumDirURL . $albumPath; return $this->transient->mirrorUrl; } return $gallery->app->albumDirURL . $albumPath; }If you notice, however, the only $type which actually does anything special is "highlight", and only if mirroring is also enabled.
Passing "full" may not be accurate, since it's completely ignored, but it doesn't do anything different.
Posts: 59
signe, only when mirror is active and it is NOT a highlight.
(strcmp return 0 if it's equal. )
With my smart mirror patch I do load balancing. So every call should get a different mirror.
And when the are calls which do not really show the image. The solution becomes crap.
So an argument should tell the methode wheter it's a real going to show.
Posts: 59
h0bbel, i will join IRC this evening/night. Thanks for inviting
Posts: 13451
adventure, great! Looking forward to talking to you.