nightly build fixes

hi developers

is there any plan to get things like the bellow to be fixed in the current " nightly build "?

1- in this example page : http://mediabox.alankabout.com/Videos/Amazing Things/
u will find (2 photos) or (1 photo) instead of " videos " . it is a video category and still getting number of
"photos"

the same thing apply om mp3 files as well.

2- also is it possible to get the flv thumbnail in the next edition as well ?

thanks
«1

Comments

  • acrylian Administrator, Developer
    1 - You can (and have to) do that easily yourself in your theme:
    `if(getAlbumTitle() === "insert-the-video-album-name") { echo "videos" } else { echo "photos" }

    Same for mp3 albums of course. Since you can have mixed albums with all types, Zenphoto does not make any difference on the item type.

    2 - What flv thumbnail do you refer to? If you mean the preview thumbnail, that is already in the nightly.
  • bill61 Member
    hi

    in my album.php i have this:

    <div id="padbox">

    <?php printAlbumDesc(true); ?>

    <div id="albums">
    <?php while (next_album()): ?>
    <div class="album">

    <div class="thumb">
    " title="<?php echo gettext('View album:'); ?> <?php echo getAlbumTitle();?>"><?php printAlbumThumbImage(getAlbumTitle()); ?>
    </div>
    <div class="albumdesc">
    <h3>" title="<?php echo gettext('View album:'); ?> <?php echo getAlbumTitle();?>"><?php printAlbumTitle(); ?></h3>
    <small><?php printAlbumDate(""); ?></small>

    so the changes should be in this code?

    if yes how?

    in regards to #2

    example video page: http://demo.xpoze.org/video.html

    my video page: http://mediabox.alankabout.com/Videos/Amazing Things/The most serious incidents filmed globally/

    thanks
    thanks
  • acrylian Administrator, Developer
    1) The code should go in that part (important is within the next_album() loop). In your current theme page must be a part where currently the "x photos" is shown. There must be a `getNumImages()`, too. You need "x photo" code within the if clause I posted above. Of course you need to change it to your album name.

    2) Zenphoto is not able to generate thumbs from movies. To get an specific image to be shown as a thumb you need to put image with the same name as the movie to the album folder.
  • bill61 Member
    hi acrylian

    so u are talking about this part in the "album.php file" where getNumImages() correct?

    <?php
    $number = getNumsubalbums();
    if ($number > 0) {
    if (!($number == 1)) { $number .= gettext(' albums'); } else { $number .= gettext(' album'); }
    $counters = $number;
    } else {
    $counters = '';
    }
    $number = getNumImages();
    if ($number > 0) {
    if (!empty($counters)) { $counters .= ", "; }
    if ($number != 1) $number .= gettext(' photos'); else $number .= gettext(' photo');
    $counters .= $number;
    }
    if (!empty($counters)) {
    echo "($counters)<br/>";

    }
    $text = htmlspecialchars(getAlbumDesc());
    if(strlen($text) > 200) {
    $text = preg_replace("/[^ ]*$/", '', substr($text, 0, 200))."...";
    }
    echo $text;

    ?>
  • bill61,

    I'm quite busy this morning and don't have time to look at this right now, but if no one else takes care of it by tonight I will look at it and post some code for you.

    -Jeremy
  • bill61 Member
    hi Mammlouk

    thanks a lot.

    regards
  • Finally had a minute to look at this. I would put all of your video album names into an array and then check for the current album title with in_array as follows

    $number = getNumImages();
    if ($number > 0) {
    $videoarr = array("Videos1", "Videos2", "Videos3");
    if(in_array(getAlbumTitle(), $videoarr)){
    $multtext = " videos";
    $singtext = " video";
    }else{
    $multtext = " photos";
    $singtext = " photo";
    }

    if (!empty($counters)) { $counters .= ", "; }

    if ($number != 1) $number .= gettext($multtext); else $number .= gettext($singtext);

    $counters .= $number;

    }

    in_array is case sensitive so make sure you enter the names of your video albums appropriately.
  • bill61 Member
    hi Mammlouk

    thanks for that

    i could not do it for some reason.

    i tried few tests but it did not work

    regards
  • It's my fault, I accidentally left an endig brace off. Just add another closing brace after the if/else statement like this:

    $number = getNumImages();
    if ($number > 0) {
    $videoarr = array("Videos1", "Videos2", "Videos3");
    if(in_array(getAlbumTitle(), $videoarr)){
    $multtext = " videos";
    $singtext = " video";
    }else{
    $multtext = " photos";
    $singtext = " photo";
    }
    }

    That should fix you up. Let you know if you have any more problems.
  • bill61 Member
    hi Mammlouk

    thanks for the reply

    may be what i am looking for is slightly diff from what u post.

    what i like to have is this:
    where is the album contains flv files than it should show instead of : "(# photos)" it should show "(# videos or videos)"

    also if the album contains "mp3 or mp4 " than it should show instead of : "(# photos)" it should show "(# audio or audios)"

    i am not sure if this can be done because i have no exp with php at all.

    the question is : how or is it possible zenphoto can recognize diff files?

    logicly speaking it should but logic and programming are two diff things.

    hope i am clear

    regards
  • hi bill61,

    I completely understand what you are trying to do, although I didn't realize you wanted it for audio also. If you want it to be completely automated then you are out of luck for a reasonably quick solution. Using the method I provided is relatively easy, the only work you have to do is fill the array of video directory names and one for audio directory names similarly. Where it says:

    $videoarr = array("Videos1", "Videos2", "Videos3");

    The values there get replaced by whatever your Video Album Names are. I know this is not quite as automated as you like, but for now it is the simplest solution. If I have enough time next week after some changes I thought of for the Google Checkout/Cart I might get to looking at it more, but I cannotmake any promises so please do not count on it.

    -Jeremy
  • bill61 Member
    hi Mammlouk

    thanks again

    ok, now this is the piece of code i have in album.php already:

    .................................
    p>
    <?php
    $number = getNumsubalbums();
    if ($number > 0) {
    if (!($number == 1)) { $number .= gettext(' albums'); } else { $number .= gettext(' album'); }
    $counters = $number;
    } else {
    $counters = '';
    }
    $number = getNumImages();
    if ($number > 0) {
    if (!empty($counters)) { $counters .= ", "; }
    if ($number != 1) $number .= gettext(' photos'); else $number .= gettext(' photo');
    $counters .= $number;
    }
    if (!empty($counters)) {
    echo "($counters)<br/>";

    }
    $text = htmlspecialchars(getAlbumDesc());
    if(strlen($text) > 200) {
    $text = preg_replace("/[^ ]*$/", '', substr($text, 0, 200))."...";
    }
    echo $text;

    ?>

    ...............................

    so it should be like this ???????:

    <?php
    $number = getNumsubalbums();
    if ($number > 0) {
    if (!($number == 1)) { $number .= gettext(' albums'); } else { $number .= gettext(' album'); }
    $counters = $number;
    } else {
    $counters = '';
    }
    $number = getNumImages();
    if ($number > 0) {
    $videoarr = array("Videos1", "Videos2", "Videos3");
    if(in_array(getAlbumTitle(), $videoarr)){
    $multtext = " videos";
    $singtext = " video";
    }else{
    $multtext = " photos";
    $singtext = " photo";
    }
    }
    if (!empty($counters)) {
    echo "($counters)<br/>";

    }
    $text = htmlspecialchars(getAlbumDesc());
    if(strlen($text) > 200) {
    $text = preg_replace("/[^ ]*$/", '', substr($text, 0, 200))."...";
    }
    echo $text;

    ?>

    .................................

    also, lets assume the actual "flv" name is :
    The_most_serious_incidents_filmed_globally_1.flv

    so for example :

    $videoarr = array("Videos1", "Videos2", "Videos3");

    will be:
    $videoarr = array("The_most_serious_incidents_filmed_globally_1", "Videos2", "Videos3");

    ?????

    regards
  • acrylian Administrator, Developer
    The easiest would be to "mark" the video or mp3 albums using the custom data field that each album has. Fill in for example "mp3" or "video" and then check that with a if/else construct.
  • bill61 Member
    hi acrylian

    the thing is i am using " custom data field " for "General Views" and "Adult Viewers Only"

    hope developers can come with something more appropriate in regards to this issue
  • acrylian Administrator, Developer
    It's not really an issue. Then I would suggest you use another field you maybe don't use currently or simple check using getAlbumTitle().
  • bill61 Member
    hi acrylian

    the zenphoto have "album.php" "image.php" but why not : "video,php" and "audio.php" ???

    may be it will be the appropriate thing i guess
  • acrylian Administrator, Developer
    I don't see any reason for that. Why should Zenphoto treat albums differently just because there are videos or audio files? Also you can have albums with all types of supported files. I gave you two not to hard suggestions, here is a third easy one: Use the album theme feature to achive a difference like "videos" instead of "photos" for specific albums.
  • bill61 Member
    hi acrylian

    do u mean create another 2 php files in the theme "in this case default" and rename them to : "video,php" and "audio.php"

    than inside the file code change to "videos" instead of "photos" and so on ??
  • bill61,

    You have it very close. The only thing is that the things you put in the array are going to be the appropriate album names, not the actual filenames.

    Another way to tag your folders without having to go bakc an edit the php to add every new one would be to name them with "_vid" and :"_aud" at the end of the album titles. Thne you have something we can check for in the album title. If that is something you are interested in instead I can throw together an example for it.
  • acrylian Administrator, Developer
    bill61: You can assign different themes to each top level album, so you could just double the theme you are using and rename it, then change it's album.php to show "videos" instead of "photos".
    But Mammlouks recent suggestions are probably the most convenient ones.
  • bill61 Member
    hi Mammlouk

    ok, so in this case lets say the sub-album name is : "Amazing Things" so it should be : Amazing Things_vid and the same for audio correct??

    and this will be apply for all sub and sub-sub albums in the main album in this case " Videos" and so on correct??

    if yes i thing the re-code should in the album.php only or in both album.php and image.php??

    regards
  • bill61 Member
    hi acrylian

    i thing so

    lets work on Mammlouk suggestion hope i get it right this time
  • bill61:

    If I understand you correctly, you have it right. Basically any album that contains actual videos (or audio tracks) will need to have the appropriate naming convention applied.

    You should only have to modify album.php

    This will take care of handling the checking of albums:

    $number = getNumImages();
    if ($number > 0) {
    if(stristr(getAlbumTitle(), "_vid")){
    $multtext = " videos";
    $singtext = " video";
    }else if(stristr(getAlbumTitle(), "_aud")){
    $multtext = " tracks";
    $singtext = " track";
    }else{
    $multtext = " photos";
    $singtext = " photo";
    }
    if (!empty($counters)) { $counters .= ", "; }
    if ($number != 1) $number .= gettext($multtext); else $number .= gettext($singtext);
    $counters .= $number;
    }

    If you want to make it so your albums aren't listed with the "_vid" or "aud" being visible then go to all of the places where getAlbumitle() is being printed (NOT WHERE IT IS USED FOR OTHER FUNCTIONS) and replace it with:

    str_ireplace("_vid", "", str_ireplace("_aud", "", getAlbumTitle()))

    I think that should take car of your problem for now. It's not very elegant, but it gets you by. I was just thinking another option that would avoid the str_ireplace fix for titles would be to put your ivde and audio tags in the album description instead and then change the stristr loop to check in getAlbumDesc() instead of getAlbumTitle().

    -Jeremy
  • bill61 Member
    hi Mammlouk

    i am doing test now but i thing i did not have the code above in the right place

    bellow is the full "album.php" file code could u pls re-write it for me according to your code above?

    you may find lines like:
    <!--Modified From Original Start-->
    <!--Modified From Original End-->
    i made this lines so i can work out the original from the modifications each time i upgrade.

    here is the code:

    <?php if (!defined('WEBPATH')) die(); $themeResult = getTheme($zenCSS, $themeColor, 'light'); $firstPageImages = normalizeColumns('2', '6');?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <?php zenJavascript(); ?>
    <title><?php printGalleryTitle(); ?> | <?php echo getAlbumTitle();?></title>
    <link rel="stylesheet" href="<?php echo $zenCSS ?>" type="text/css" />
    <?php printRSSHeaderLink('Album',getAlbumTitle()); ?>
    </head>

    <body>

    <div id="main">

    <!--Modified From Original Start-->
    <div id="gallerytitle">
    <?php if (getOption('Allow_search')) { printSearchForm(''); } ?><br>
    <h2><span><?php printHomeLink('', ' | '); ?>" title="<?php echo gettext('Albums Index'); ?>"><?php echo getGalleryTitle();?> | <?php printParentBreadcrumb(); ?></span> <?php printAlbumTitle(true);?></h2>
    </div>
    <!--Modified From Original End-->

    <!--Modified From Original Start-->

    <!--Google AdSense Start-->
    <script type="text/javascript"><!--
    google_ad_client = "pub-3990536319331218";
    /* 468x15, created 5/29/08 */
    google_ad_slot = "3140085176";
    google_ad_width = 468;
    google_ad_height = 15;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    <br><br>
    <!--Google AdSense End-->

    <!--Modified From Original End-->

    <div id="padbox">

    <?php printAlbumDesc(true); ?>

    <div id="albums">
    <?php while (next_album()): ?>
    <div class="album">

    <div class="thumb">
    " title="<?php echo gettext('View album:'); ?> <?php echo getAlbumTitle();?>"><?php printAlbumThumbImage(getAlbumTitle()); ?>
    </div>
    <div class="albumdesc">
    <h3>" title="<?php echo gettext('View album:'); ?> <?php echo getAlbumTitle();?>"><?php printAlbumTitle(); ?></h3>
    <small><?php printAlbumDate(""); ?></small>

    <!--Modified From Original Start-->
    <br>
    <span class="CustomData"><?php
    if (getAlbumCustomData()) echo getAlbumCustomData();
    if (getAlbumCustomData()) getAlbumCustomData();
    getAlbumCustomData();
    ?> </span>

    <?php
    $number = getNumsubalbums();
    if ($number > 0) {
    if (!($number == 1)) { $number .= gettext(' albums'); } else { $number .= gettext(' album'); }
    $counters = $number;
    } else {
    $counters = '';
    }
    $number = getNumImages();
    if ($number > 0) {
    if (!empty($counters)) { $counters .= ", "; }
    if ($number != 1) $number .= gettext(' photos'); else $number .= gettext(' photo');
    $counters .= $number;
    }
    if (!empty($counters)) {
    echo "($counters)<br/>";

    }
    $text = htmlspecialchars(getAlbumDesc());
    if(strlen($text) > 200) {
    $text = preg_replace("/[^ ]*$/", '', substr($text, 0, 200))."...";
    }
    echo $text;

    ?>

    <!--Modified From Original End-->

    </div>
    <p style="clear: both; ">
    </div>
    <?php endwhile; ?>
    </div>

    <div id="images">
    <?php while (next_image(false, $firstPageImages)): ?>
    <div class="image">
    <div class="imagethumb">" title="<?php echo getImageTitle();?>"><?php printImageThumb(getImageTitle()); ?></div>
    </div>
    <?php endwhile; ?>

    </div>

    <?php printPageListWithNav("« ".gettext("prev"), gettext("next")." »"); ?>
    <?php printTags('links', gettext('Tags:').' ', 'taglist', ''); ?>

    </div>
    <?php if (function_exists('printSlideShowLink')) printSlideShowLink(gettext('View Slideshow')); ?>
    <?php if (function_exists('printAlbumRating')) { printAlbumRating(); }?>

    <!--Modified From Original Start-->
    <table border="0" width='100%'>
    <tr><td><?php if (getOption('Allow_ratings')) { printAlbumRating(); }?></td>
    <td valign='center' align='right'>Album Viewed: <?php echo hitcounter("album",false) ?> Times</td></tr>
    </table>
    <!--Modified From Original End-->
    </div>

    <div id="credit"><?php printRSSLink('Album', '', gettext('Album RSS'), ''); ?> | ?p=archive"><?php echo gettext("Archive View"); ?> | <?php echo gettext("Powered by"); ?> ">zenphoto</div>

    <?php printAdminToolbox(); ?>

    </body>
    </html>
  • Yeah, I will post it later tonight.
  • Sorry, didn't have time last night, I will try to get it up today.
  • bill61 Member
    hi Mammlouk

    it is ok
  • O.k. here is the change to recognize the directories have video/audio/photo based on the name. All of the changes are included within the third "modified" block. I am only posting that portion because the rest of the file you posted has errors due to the forum parsing your a refs. To avoid that in the future surround the code in back tick marks. If you would like me to add the code to strip the vid and aud from being show I will need you to repost the code within bacticks so I can accurately find all applicable portions.

    `




    <?php<br />
    if (getAlbumCustomData()) echo getAlbumCustomData();

    if (getAlbumCustomData()) getAlbumCustomData();

    getAlbumCustomData();

    ?>

    <?php<br />
    $number = getNumsubalbums();

    if ($number > 0) {

    if (!($number == 1)) { $number .= gettext(' albums'); } else { $number .= gettext(' album'); }

    $counters = $number;

    } else {

    $counters = '';

    }

    $number = getNumImages();

    if ($number > 0) {

    if(stristr(getAlbumTitle(), " vid")){

    $multtext = " videos";

    $singtext = " video";

    }elseif(stristr(getAlbumTitle(), " aud")){

    $multtext = " tracks";

    $singtext = " track";

    }else{

    $multtext = " photos";

    $singtext = " photo";

    }

    if (!empty($counters)) { $counters .= ", "; }

    if ($number != 1) $number .= gettext($multtext); else $number .= gettext($singtext);

    $counters .= $number;

    }

    if (!empty($counters)) {

    echo "($counters)
    ";

    }

    $text = htmlspecialchars(getAlbumDesc());

    if(strlen($text) > 200) {

    $text = preg_replace("/[^ ]*$/", '', substr($text, 0, 200))."...";

    }

    echo $text;

    ?>

    `
  • bill61 Member
    hi Mammlouk

    thanks for the help for the last days

    it works perfectly well now.

    something else related to this i am not realy sure if it can be done.

    i the home page : http://mediabox.alankabout.com/

    u will find:

    Gallery data

    Albums: ## · SubAlbums: ## · Images: ## · Comments: ##

    now, how can i get the numbers for : Videos and Audio Tracks ??

    in index.php the code is:

    <!--Modified From Original Start-->

    <br>

    <h2>Gallery data</h2>
    <small>
    Albums: <?php $albumNumber = getNumAlbums(); echo $albumNumber ?> ·
    SubAlbums: <?php show_subalbum_count(); ?> ·
    Images: <?php $photosArray = query_single_row("SELECT count(*) FROM ".prefix('images'));
    $photosNumber = array_shift($photosArray); echo $photosNumber ?>
    <?php if (getOption('Allow_comments')) { ?>
    ·
    Comments: <?php $commentsArray = query_single_row("SELECT count(*) FROM ".prefix('comments')." WHERE inmoderation = 0");
    $commentsNumber = array_shift($commentsArray); echo $commentsNumber ?>
    <?php } ?>

    </small>
    </div>

    <!--Modified From Original End-->

    regards
  • I had a feeling that would be the next question. I'll respond later today. :)
Sign In or Register to comment.