Some questions and suggestion
-
First, let me thank you for your excellent work. I have been looking for something like this for a while. I do have a few issues/questions/suggestions though.
1. You set the pa-embed-player DIV style using the variable
embedHeight
(andembedWidth
if stretch is set to false) BUT these are not actually set anywhere in your code. Adding the following line to yourget_embed_player_html_code
function would work:$embedHeight = $height;
2. What is the purpose of the
imageWidth
andimageHeight
variables? I ask because removing that from the image sources doesn’t seem to affect the output (and can be helpful – see #3). Also, many albums have both portrait and landscape photos so in theory each photo should have its dimensions assigned dynamically to be accurate but you just set them all to the same dimensions. IF there is some actual purpose for setting these dimensions, perhaps you should return them in theparse_photos
function? For example, you could change that function’s return code to:
return array_unique($m[0]);
Then in the
get_embed_player_html_code
function you could add something like this:foreach ($photos as $photo) { $photo = str_replace('"','',$photo); $photo_src = substr($photo,0,strpos($photo,",")+1); $photo_src = str_replace(',','',$photo_src); $temp = substr($photo,strpos($photo,",")+1); $imageWidth = substr($temp,0,strpos($temp,",")); $imageHeight = substr($temp,strpos($temp,",")+1); .... }
It’s not efficient code so I am sure you can do better, but you get the idea at least I hope.
3. Related to #2, the stretch feature doesn’t work for my album because it has a combination of portrait and landscape photos. I took a look at your
pa-embed-player.min.js
file and after a lot of digging and trial and error (I am not good with Javascript), I found that if I change yourfunction bd(a)
to the following I can get it to stretch the landscape photos and not stretch the portrait ones:function bd(a){if(a.b.src){var b=new y(0,0,a.b.naturalWidth,a.b.naturalHeight),c=kb(a.c());b=new y(0,0,b.width,b.height);var d=b.width/b.height;e=c.width/c.height;if(d<1){b.width=b.width;b.height=b.height;}else{e>d?(b.width=c.height*e,b.height=c.height):(b.width=c.width,b.height=c.width/d)};b.D=Math.round((c.width-b.width)/2);b.F=Math.round((c.height-b.height)/2);gb(a.b,new x(b.width,b.height));a=a.b;b=new r(b.D,b.F);b instanceof r?(c=b.a,b=b.b):(c=b,b=void 0);a.style.left=hb(c,!1);a.style.top=hb(b,!1)}}
Note though that this only works if I edit the core PHP file to NOT set the width or height for any of the individual photos. So, I changed the following line:
$src = sprintf('%s=w%d-h%d', $photo, $imageWidth, $imageHeight);
to:
$src = sprintf('%s', $photo);
I would love to hear your thoughts on all of this. I have only tried with one album so far so while it seems to be working well I may be missing something that will cause problems in other circumstances.
4. Do you know if there is any way to determine the cover photo for an album? If so, it would be good to make that the first photo displayed. I did a very quick online search and it seems like that isn’t possible but maybe I missed something that you know of?
5. The plugin would be more user-friendly if you added a toolbar to the editor to quickly insert the relevant shortcode.
6. I notice that your script generator misspells “description” (you spell it as “descrition” without a p). I see that is true for your JS file as well as the code generator on your publicalbum.org site.
7. Is there a reason you don’t just bundle the JS file with the plugin so it can be a local server call instead of a call to the file location on your server?
- The topic ‘Some questions and suggestion’ is closed to new replies.