How to show animated gifs

I uploaded a animated gif, but he show only 1 image.
But an animated gif is a loop of frames.

only 1 frame is shownd.

http://www.busimatch.club ( The most exclusive business club)
Quote · 6 Jun 2013

There are a multitude of discussions on this.

I am just so bogged down at work I am unable to fix it.

I think I have narrowed the issue down to the following scripts.

inc/images.inc.php
bxphotosuploader.php
bxphotosmodules.php
bxphotospageview.php
bxphotossearch.php
inc/classes/bxdolimageresize.php

At one point in playing with the code, I was able to upload a GIF, but was only able to get the actual image by clicking "view original".

It's a $20.00 mod if someone would take some time to modify this.  There are several people here willing to pay.

http://www.mytikibar.com
Quote · 6 Jun 2013

images for the "normal view" are converted to jpg.  It would be nice if the image format was not converted to jpg.  Animated gifs can still be used in some places if one uses the original image.  Animated avatars are not supported directly either.

Geeks, making the world a better place
Quote · 6 Jun 2013

Well there isn't any good solution in GD that always works, you need to have ImageMagick.

so much to do....
Quote · 6 Jun 2013

I know a site that has animated gifs done, and working perfect.

I cannot disclose the site, but I will make a snippet of the site with them working.

http://www.youtube.com/watch?v=GoKhoh7NcfI

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 6 Jun 2013

Thanks Newton.  I inspected and see they are using the trick I discovered in some way.  Dolphin stores avatars as jpgs and expects to see .jpg in the file name.  However, if you rename a gif image to a jpg image, such as animated.gif to animated.jpg, Dolphin will load that animated gif.  Browsers do not use the extension of the file, they use the header info to determine the file type; or at least that is a guess as I have not verify this.  I have manually created the two images, the 32X32 and 64X64 animated avatars, renamed to xxxx.jpg and then manually assigned them to an account.  They work perfectly but that is a rather tedious way to do it.

It would be nice if the site (which I won't mention either) could share the changes they made in the avatar module to allow one to upload an animated gif and have the avatar module store it.  I just don't have the time to play with this myself to see if I can get something working.  However, if that site did it, then it can be done and works with Dolphin.

Geeks, making the world a better place
Quote · 6 Jun 2013

 thats pretty interesting to know about. Oh and i will try the rename thingy too.

Thanks Newton.  I inspected and see they are using the trick I discovered in some way.  Dolphin stores avatars as jpgs and expects to see .jpg in the file name.  However, if you rename a gif image to a jpg image, such as animated.gif to animated.jpg, Dolphin will load that animated gif.  Browsers do not use the extension of the file, they use the header info to determine the file type; or at least that is a guess as I have not verify this.  I have manually created the two images, the 32X32 and 64X64 animated avatars, renamed to xxxx.jpg and then manually assigned them to an account.  They work perfectly but that is a rather tedious way to do it.

It would be nice if the site (which I won't mention either) could share the changes they made in the avatar module to allow one to upload an animated gif and have the avatar module store it.  I just don't have the time to play with this myself to see if I can get something working.  However, if that site did it, then it can be done and works with Dolphin.

 EDIT: Nop doesn't work.

so much to do....
Quote · 6 Jun 2013

i had this issue a year or so ago. I made members mail me gifs so that they could be "approved" first. Once approved, they would appear in the default avatar lists and all users would be able to use the avatars. At the time, I did not have an issue with this as I did not want a user uploading an explicit animated gif for their avatars.

caredesign.net
Quote · 6 Jun 2013

 

 thats pretty interesting to know about. Oh and i will try the rename thingy too.

Thanks Newton.  I inspected and see they are using the trick I discovered in some way.  Dolphin stores avatars as jpgs and expects to see .jpg in the file name.  However, if you rename a gif image to a jpg image, such as animated.gif to animated.jpg, Dolphin will load that animated gif.  Browsers do not use the extension of the file, they use the header info to determine the file type; or at least that is a guess as I have not verify this.  I have manually created the two images, the 32X32 and 64X64 animated avatars, renamed to xxxx.jpg and then manually assigned them to an account.  They work perfectly but that is a rather tedious way to do it.

It would be nice if the site (which I won't mention either) could share the changes they made in the avatar module to allow one to upload an animated gif and have the avatar module store it.  I just don't have the time to play with this myself to see if I can get something working.  However, if that site did it, then it can be done and works with Dolphin.

 EDIT: Nop doesn't work.

Yes, it does work but as I said, it is tedious.  the small avatar and larger avatar have slightly different names.

Here is what you can do.  First find out what the avatar number is for your avatar.  Then create an avatar in the two different sizes.  I use a graphic programme that could resize animated gifs; creating the 64x64 one first, then resizing and saving as the 32x32.  I then uploaded the gifs and renamed on the server.   Of course you have to clear caches; including your browser, to see the change.  In my case I looked to see what avatar number was free, created my avatars, uploaded them, then I went into the database and assigned the avatars to me.

I have not done this on the current production server.  If you really need to see that I am telling you the truth, I can PM you the address of the old 7.0.9 site that is getting ready to go bye-bye.

Geeks, making the world a better place
Quote · 6 Jun 2013

 

i had this issue a year or so ago. I made members mail me gifs so that they could be "approved" first. Once approved, they would appear in the default avatar lists and all users would be able to use the avatars. At the time, I did not have an issue with this as I did not want a user uploading an explicit animated gif for their avatars.

I thought about this as a means to get a bit of revenue for the site.  Anyone wanting an animated avatar could email me the one they wanted to use, I would create the two sizes, upload them to the site, and assign them to the user.  All for a small fee.

Geeks, making the world a better place
Quote · 6 Jun 2013

Step by Step for people who want to try it

http://modmycms.com/m/tutorials/view/Dolphin-Mod-Use-Animated-GIF-s

http://ModMyCMS.com --> Dolphin Hacks &Mods
Quote · 6 Jun 2013

 

http://modmycms.com/m/tutorials/view/Dolphin-Mod-Use-Animated-GIF-s

 LMAO! What a great example, made me almost choke!

Great work, as usual!!!! "Like" from me Cool

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 6 Jun 2013

Yes, that is how it can be done.  However, how can we rework the avatar module to do it?  Here is a link to a method to resize animated gifs using php without needing ImageMagick.  If this procedure could be incorporated into the avatar module, then someone could upload an animated gif, resize it to the two different sizes, save as x.jpg, and xi.jpg, and be good to go.

http://lifetimedev.blogspot.com/2012/02/how-to-resize-animated-gif-without.html

Geeks, making the world a better place
Quote · 6 Jun 2013

 

My Imagemagik is on... but it'snot working...
When a module gonna be ready? :-) 

 

 

 

I know a site that has animated gifs done, and working perfect.

I cannot disclose the site, but I will make a snippet of the site with them working.

http://www.youtube.com/watch?v=GoKhoh7NcfI

 

http://www.busimatch.club ( The most exclusive business club)
Quote · 8 Jun 2013

Sorry All- I hadn't seen this post before today....

I'm a little familiar with the site in the video LMAO....

Just to make clear, GG is spot on- It was a pain in the ass and yes, using methods we had discussed throughout the forums here.

Everything had to be done manually and not practical for any of us ***without a small fee*** X~)

I do although hope a module is developed or avatar module reworked cuz it seems there is still some interest for it YES?

I saw this- http://www.boonex.com/n/it-s-your-choice-your-mod-request-for-09-13  perhaps a show of support may push it forward?

Again, my apologies, I would be happy to share anything I manage to get working on my site- You all have done so much for me :)

Quote · 15 Sep 2013

 

I do although hope a module is developed or avatar module reworked cuz it seems there is still some interest for it YES?

 I just don't see it happening with the current way the avatar photos are cropped then saved. This alone throws that out the window.

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 15 Sep 2013

 

 

I do although hope a module is developed or avatar module reworked cuz it seems there is still some interest for it YES?

 I just don't see it happening with the current way the avatar photos are cropped then saved. This alone throws that out the window.

 I suppose this is why some sites have you specifically add a 32x32 or 64x64 ect... Thumbnail image...

And if I recall, There was not Crop process...seems those sites had animated image functionality.

Quote · 15 Sep 2013

It seems that a POST-Avatar Crop mod would somehow be possible...

Something that allowed members to "Swap" their current avatar with an animated one?

If that makes sense.

Because basically, that's what we're doing to get this to work- Swapping the after-destuction avatar with 32px and 64px animated ones.

On my site, I replaced ALL the images with animated ones- Profile Pic, Wall Post, Avatar etc...

But, I finally concluded I was just going overboard with the whole thing.

Would still like to do it with avatars though.

Quote · 15 Sep 2013

Well, playing around with the code I noticed boonex has a default extension of JPG.

I was able to get it to NOT convert a GIF to a JPG but, boonex wants to default to displaying a JPG all the time.

If I view original I can see the animation, otherwise, it's just a blank image in the thumbs and album covers.

To make the avatars animated, someone is going to HAVE to work on the default photo module and allow it to display something other than JPG's by default.

http://www.mytikibar.com
Quote · 16 Sep 2013

 

Well, playing around with the code I noticed boonex has a default extension of JPG.

I was able to get it to NOT convert a GIF to a JPG but, boonex wants to default to displaying a JPG all the time.

If I view original I can see the animation, otherwise, it's just a blank image in the thumbs and album covers.

To make the avatars animated, someone is going to HAVE to work on the default photo module and allow it to display something other than JPG's by default.

Yes; however, what we have discovered is that browsers, or at least the ones I tested it on, do not look at the extension to determine the type of image, they look at the header of the file to know how to render the image.  Therefore, animated gifs with a jpg extension are animated in the browser.  We would need to test all major browsers to see it this holds for all.

Geeks, making the world a better place
Quote · 16 Sep 2013

I haven't thought this all the way through, but- What about a way to use an embedded image avatar?

Like a gif in an iframe as an avatar or something?

And also, somehow using css to re-size down a 64px image to 32px via-

background-size: 100%;

Just throwing some other things out there that might spark other ideas from people who know way more than me about this stuff.

Quote · 16 Sep 2013

Well....

I have it working!

I need to go over my notes, but I will post what it takes to get animated gifs into dolphin.

It does require an external php class, but the instructions will show you how to do that.

http://www.mytikibar.com
Quote · 22 Sep 2013

 

I have it working!

 Excellent!

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 22 Sep 2013

How to make dolphin support animated gifs in photos and avatars!

PLEASE do this on a test site 1st!  Do NOT try this on your live site!

This works for me with Dolphin 7.0.9, if you can get it to work with higher versions, please share with the others.

You will need the attached file php-gif-resizer.php

upload gifresizer.php to your /inc folder located inside the archive php-gif-resizer.php.


in the file inc/classes/bxdolimageresize.php
around line 222 you'll find

            else
                    {               
                $dst_im = $src_im;
                $convertResult = true;
            }

    else // this is for old GD versions and for GIF images
    {

change to

            else
                    {               
                $dst_im = $src_im;
                $convertResult = true;
            }
###
#SteveSoft
#09-21-2013
#
        }else if ($size[2] == IMAGE_TYPE_GIF){
           
            require_once( BX_DIRECTORY_PATH_INC . 'gifresizer.php' );
            $gr = new gifresizer;    //New Instance Of GIFResizer
            $gr->temp_dir = "../tmp"; //Used for extracting GIF Animation Frames
            $gr->resize($sSrcImage,$sDstImage,$destW,$destH); //Resizing the animation into a new file.
               
            $convertResult = true;
            $writeResult   = true;
        }
        else // this is for old GD versions and for GIF images
        {

in the file /templates/base/BxBaseSearchResultSharedMedia.php

around line 357 find

    function _getSharedThumb ($iId, $sFileLink, $sHash = '') {

        $sIdent = strlen($sHash) > 0 ? $sHash : $iId;

change to
#SteveSoft
#09-21-2013
#
    function _getSharedThumb ($iId, $sFileLink, $sHash = '',$sExt) {

        $sIdent = strlen($sHash) > 0 ? $sHash : $iId;


in the file /templates/tmpl_YOURTEMPLATEHERE/BxTmplSearchResult.php

around line 16 find
        function _getSharedThumb ($iId, $sFileLink, $sHash = '') {
           
        $sIdent = strlen($sHash) > 0 ? $sHash : $iId;

change to

###
#SteveSoft
#09-21-2013
        function _getSharedThumb ($iId, $sFileLink, $sHash = '', $sExt) {
           
        $sIdent = strlen($sHash) > 0 ? $sHash : $iId;



in the file modules/boonex/photos/classes/bxphotosuploader.php


around line 441 find

                // force into JPG
                $sExtension = '.jpg';

change to

###
#SteveSoft
#09-21-2013
#               
                // force into JPG
                //$sExtension = '.jpg';


in the file modules/boonex/photos/classes/bxphotosconfig.php

        $this->aFilePostfix = array(
            'thumb' => '_rt.jpg',
            'browse' => '_t.jpg',
            'icon' => '_ri.jpg',
            'file' => '_m.jpg',
            'original' => '.{ext}'
        );

change to

###
#SteveSoft
#09-21-2013
#
        $this->aFilePostfix = array(
            'thumb' => '_rt.{ext}',
            'browse' => '_t.{ext}',
            'icon' => '_ri.{ext}',
            'file' => '_m.{ext}',
            'original' => '.{ext}'
        );


in the file modules/boonex/photos/classes/bxphotossearch.php

around line 44 find
        $this->aCurrent['ownFields'] = array('ID','Title', 'Uri', 'Date', 'Size', 'Views', 'Rate', 'RateCount', 'Hash');

change to
###
#SteveSoft
#09-21-2013
#
        $this->aCurrent['ownFields'] = array('ID', 'Ext','Title', 'Uri', 'Date', 'Size', 'Views', 'Rate', 'RateCount', 'Hash');

around line 118 find

        $aPics = $this->oModule->oAlbums->getAlbumCoverFiles($iAlbumId, array('table'=>$this->aCurrent['table'], 'field'=>'ID', 'fields_list'=>array('Hash')), array(array('field'=>'Status', 'value'=>'approved')));
 
change to

###
#SteveSoft
#09-21-2013
#
        $aPics = $this->oModule->oAlbums->getAlbumCoverFiles($iAlbumId, array('table'=>$this->aCurrent['table'], 'field'=>'ID', 'fields_list'=>array('Hash','Ext')), array(array('field'=>'Status', 'value'=>'approved')));
 
around line 126 find
    function getAlbumCoverUrl (&$aIdent) {
        return $this->getImgUrl($aIdent['Hash'], 'thumb');
    }

change to
    function getAlbumCoverUrl (&$aIdent) {
###
#SteveSoft
#09-21-2013
#
        return $this->getImgUrl($aIdent['Hash'], 'thumb',$aIdent['Ext']);
    }

around line 134 find
    function getImgUrl ($sHash, $sImgType = 'browse') {

        return BX_DOL_URL_ROOT . $this->oModule->_oConfig->getBaseUri() . 'get_image/' . $sImgType .'/' . $sHash . '.jpg';

change to

    function getImgUrl ($sHash, $sImgType = 'browse',$sExt) {
###
#SteveSoft
#09-21-2013
#       

        return BX_DOL_URL_ROOT . $this->oModule->_oConfig->getBaseUri() . 'get_image/' . $sImgType .'/' . $sHash . '.' .$sExt;


around line 199 find
       $aImageInfo = $this->_getImageDbInfo($iId);
               
        $iWidth = (int)$this->oModule->_oConfig->getGlParam($sType . '_width');

add
###
#SteveSoft
#09-21-2013
#
        if (!$aImageInfo['Ext'] )
        $aImageInfo['Ext'] = $aImageInfo['ext'];


around line 329 find

        foreach ($aFiles as $k => $aRow) {
            $aFiles[$k]['icon']  = $this->getImgUrl($aRow['Hash'], 'icon');
            $aFiles[$k]['thumb'] = $this->getImgUrl($aRow['Hash'], 'thumb');
            $aFiles[$k]['file']  = $this->getImgUrl($aRow['Hash'], 'file');
        }

change to
###
#SteveSoft
#09-21-2013
#
        foreach ($aFiles as $k => $aRow) {
            $aFiles[$k]['icon']  = $this->getImgUrl($aRow['Hash'], 'icon',$aRow['Ext']);
            $aFiles[$k]['thumb'] = $this->getImgUrl($aRow['Hash'], 'thumb',$aRow['Ext']);
            $aFiles[$k]['file']  = $this->getImgUrl($aRow['Hash'], 'file',$aRow['Ext']);
        }

around line 348 find
        foreach ($aFiles as $k => $aRow) {
            $aFiles[$k]['icon']  = $this->getImgUrl($aRow['Hash'], 'icon');
            $aFiles[$k]['thumb'] = $this->getImgUrl($aRow['Hash'], 'thumb');
            $aFiles[$k]['file']  = $this->getImgUrl($aRow['Hash'], 'file');
        }

change to
###
#SteveSoft
#09-21-2013
#
        foreach ($aFiles as $k => $aRow) {
            $aFiles[$k]['icon']  = $this->getImgUrl($aRow['Hash'], 'icon',$aRow['Ext']);
            $aFiles[$k]['thumb'] = $this->getImgUrl($aRow['Hash'], 'thumb',$aRow['Ext']);
            $aFiles[$k]['file']  = $this->getImgUrl($aRow['Hash'], 'file',$aRow['Ext']);
        }

around line 264 find

        foreach ($aFiles as $k => $aRow) {
            $aFiles[$k]['icon']  = $this->getImgUrl($aRow['Hash'], 'icon');
            $aFiles[$k]['thumb'] = $this->getImgUrl($aRow['Hash'], 'thumb');
        $aFiles[$k]['browse'] = $this->getImgUrl($aRow['Hash'], 'browse');
            $aFiles[$k]['file']  = $this->getImgUrl($aRow['Hash'], 'file');
        }

change to

###
#SteveSoft
#09-21-2013
#               
        foreach ($aFiles as $k => $aRow) {
            $aFiles[$k]['icon']  = $this->getImgUrl($aRow['Hash'], 'icon',$aRow['Ext']);
            $aFiles[$k]['thumb'] = $this->getImgUrl($aRow['Hash'], 'thumb',$aRow['Ext']);
        $aFiles[$k]['browse'] = $this->getImgUrl($aRow['Hash'], 'browse',$aRow['Ext']);
            $aFiles[$k]['file']  = $this->getImgUrl($aRow['Hash'], 'file',$aRow['Ext']);
        }


around line 569 find

            foreach ($aFilesList as $iKey => $aData) {
                $sPicUrl = $this->getImgUrl($aData['Hash'], 'icon');

change to
###
#SteveSoft
#09-21-2013
#           
            foreach ($aFilesList as $iKey => $aData) {
                $sPicUrl = $this->getImgUrl($aData['Hash'], 'icon',$aData['Ext']);

around line 662 find
        $aUnit = array(
            'switchWidth' => $iWidth,
            'switchWidthOut' => $iWidth + 4,
            'imgWidth' => strlen($aAddElems['imgWidth']) > 0 ? $aAddElems['imgWidth']: '',
            'picUrl' => $this->getImgUrl($aData['Hash'], 'file'),

change to

###
#SteveSoft
#09-21-2013
#
        $aUnit = array(
            'switchWidth' => $iWidth,
            'switchWidthOut' => $iWidth + 4,
            'imgWidth' => strlen($aAddElems['imgWidth']) > 0 ? $aAddElems['imgWidth']: '',
            'picUrl' => $this->getImgUrl($aData['Hash'], 'file',$aData['Ext']),


and that should do it!

If I missed something in my notes, please let me know. 

If you have screen shots of the image, then right click the image and screen shot me the firebug information for that image, I can probably figure out what's missing.

One note, for some reason if you had PNG's uploaded, they will be blanked out.  I could not for the LIFE of me figure out why!

Oh! Bonus!  This also gives you the ability to support animated avatars with no further coding!


If this works for you, please let me know. 

php-gif-resizer.tar.gz · 244.2K · 500 downloads
http://www.mytikibar.com
Quote · 22 Sep 2013

X~D Seriously???!!!

Great Work- You Rock!

I'll give her a go on 7.1.4....fingers crossed Sealed

THANKS!

Quote · 23 Sep 2013

OK....Got to this part of the instructions of editing the last file:

around line 199 find
       $aImageInfo = $this->_getImageDbInfo($iId);
              
        $iWidth = (int)$this->oModule->_oConfig->getGlParam($sType . '_width');

add
###
#SteveSoft
#09-21-2013
#
        if (!$aImageInfo['Ext'] )
        $aImageInfo['Ext'] = $aImageInfo['ext'];


Did you mean- add after?

Should it look like this after the change:

 

       // predefined sizes
        $aType2Image = array(
            'thumb' => 64, 'icon' => 32, 'file' => 600, 'browse' => 140, 'original' => 0
        );
        $aImageInfo = $this->_getImageDbInfo($iId);

        $iWidth = (int)$this->oModule->_oConfig->getGlParam($sType . '_width');
###
#SteveSoft
#09-21-2013
#
        if (!$aImageInfo['Ext'] )
        $aImageInfo['Ext'] = $aImageInfo['ext'];
        $iHeight = (int)$this->oModule->_oConfig->getGlParam($sType . '_height');
        $iWidth = $iWidth == 0 ? $aType2Image[$sType] : $iWidth;
        $iHeight = $iHeight == 0 ? $aType2Image[$sType] : $iHeight;

        $sImagePath = $sImageUrl = $sBrowseUrl = '';

 

Thanks

Quote · 23 Sep 2013

Currently on 7.1.4 with the modifications as I have them now-

It goes through the add avatar process....

I select the animated Gif....

It refreshes to the image crop process...

I can see my image and it is animated...

I click "Add Avatar" and it refreshes like all is well...

BUT then displays- "Set avatar failed" in a pink ribbon across the page...

REALLY? Pink?

Oh...I mean----> Dang-It! It didn't work!

OK...must need a little code adjustment somewhere...I'll play with it a bit further...seems it's close :)

Quote · 23 Sep 2013

 



Did you mean- add after?

Should it look like this after the change:

 

       // predefined sizes
        $aType2Image = array(
            'thumb' => 64, 'icon' => 32, 'file' => 600, 'browse' => 140, 'original' => 0
        );
        $aImageInfo = $this->_getImageDbInfo($iId);

        $iWidth = (int)$this->oModule->_oConfig->getGlParam($sType . '_width');
###
#SteveSoft
#09-21-2013
#
        if (!$aImageInfo['Ext'] )
        $aImageInfo['Ext'] = $aImageInfo['ext'];
        $iHeight = (int)$this->oModule->_oConfig->getGlParam($sType . '_height');
        $iWidth = $iWidth == 0 ? $aType2Image[$sType] : $iWidth;
        $iHeight = $iHeight == 0 ? $aType2Image[$sType] : $iHeight;

        $sImagePath = $sImageUrl = $sBrowseUrl = '';

 

Thanks

 Yes.  There is ONE routine in the dolphin code that assigns the extension as 'ext'.  EVERYWHERE else it's 'Ext'.  So, I had to put that check in there to make sure my 'Ext' variable is set.

This was FAR easier than rewriting the entire routine!

http://www.mytikibar.com
Quote · 23 Sep 2013

 


I can see my image and it is animated...

I click "Add Avatar" and it refreshes like all is well...

BUT then displays- "Set avatar failed" in a pink ribbon across the page...

REALLY? Pink?

Oh...I mean----> Dang-It! It didn't work!

OK...must need a little code adjustment somewhere...I'll play with it a bit further...seems it's close :)

 Can you upload an animated gif as a regular photo?  If it fails there then we need to look in...

/inc/classes/BxDolImageResize.php in

function _resizeGD ($sSrcImage, $sDstImage) {

Oh yeah, I am using GD not imagemagik. 

I just realized some might be using imagemagik.

You'll have to add the code from

function _resizeGD ($sSrcImage, $sDstImage) {

if ($size[2] == IMAGE_TYPE_GIF){
           

            require_once( BX_DIRECTORY_PATH_INC . 'gifresizer.php' );
            $gr = new gifresizer;    //New Instance Of GIFResizer
            $gr->temp_dir = "../tmp"; //Used for extracting GIF Animation Frames
            $gr->resize($sSrcImage,$sDstImage,$destW,$destH); //Resizing the animation into a new file.
               
            $convertResult = true;
            $writeResult   = true;

and make it work with imagemagik.

http://www.mytikibar.com
Quote · 23 Sep 2013

OK, I hadn't noticed before----> When I browse for an image and select a gif, the screen refreshes and in red just below the browse button, it says- "Image upload failed".....Strangely enough though, it shows the animated Gif down in the cropping window Undecided

I can add jpg avatars....and png as well....gifs fail.

Trying to go the route of basic photo uploading----> jpgs and pngs go through the motions, but the form for adding the image doesn't show a preview image....and after submitting the form, the image doesn't appear on the site, yet there seems to be a placeholder and page for the image...

Gif image uploads fail and the form doesn't appear at all.


BTW- There are a few code differences in 7.1.4 as well....not many....but a few.

I'll attach the 7.1.4 files so you can see....It's mostly in that BxPhotoSearch.php file.


Not sure about the imageMagik part....Can I check that with Host Tools in admin?

I'm not sure about Zarconia config there....It's pretty damn solid though.

BxBaseSearchResultSharedMedia.php · 29.7K · 477 downloads
BxDolImageResize.php · 14.3K · 506 downloads
BxPhotosConfig.php · 1.3K · 474 downloads
BxPhotosSearch.php · 26.5K · 471 downloads
BxPhotosUploader.php · 24.7K · 486 downloads
Quote · 23 Sep 2013

Host Tools says we're using GD :)

Quote · 23 Sep 2013

1st if you don't have a routine like this, put it in your header.inc.php

 

###
#SteveSoft
#
function DEBUGGER($sText) {
    global $dbx;
    $sMessage = mysql_escape_string($sText);
   
    $sql = "INSERT INTO `debugger_log` (`log_date` ,`log_text` ,`log_extra`) VALUES (CURRENT_TIMESTAMP, '".$sMessage."', '".(int)$_COOKIE['memberID']."');";
    $result = mysql_query($sql,$GLOBALS['bx_db_link']);
}

use this query is phpmyadmin or command line if you prefer


CREATE TABLE IF NOT EXISTS `debugger_log` (
  `log_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `log_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `log_text` text NOT NULL,
  `log_extra` int(11) DEFAULT NULL,
  PRIMARY KEY (`log_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=71896 ;

 

You call it like this  DEBUGGER('some field ' . $sSomeField);

or DEBUGGER('some array ' . print_r($aSomeArray,true));

Then you can see what those variables are when trouble shooting.

Now, on to the problem.

It seems it is 2 fold, so, 1st, remove anything that is attempting to convert to GIF's.

Let's see if we can just upload a JPG and get it to display.

If it uploads but doesn't display, I'm willing to bet when you inspect the element, the source URL is missing the extension.

Since it is, we have to poke in the code and find what routine is NOT passing the $sExt variable.

What I did with 7.0.9 is following the code thru all the subroutines, changing where dolphin forces a .jpg extension to the $sExt variable and making sure that that variable is passed from routine to routine.

The DEBUGGER function is indispensable for doing this.

Once you can upload a .JPG, a .PNG, and a .GIF and it displays in the thumb, medium and full, THEN you can add back the code to keep the animation in the .GIF image,

This way you are not fighting 2 issues at once.

Let me know what happens!

http://www.mytikibar.com
Quote · 23 Sep 2013

"1st if you don't have a routine like this, put it in your header.inc.php"

Alrighty then....Don't have that....Never used anything more than error logs for resolving issues.

BUT, I've added the code to the end of my header.inc.php and ran that SQL code adding a debugging table to my database.

Now, I'll need to learn how to use it for problem-solving :)

Sorry, I'm not quite sure what you mean here-

"You call it like this  DEBUGGER('some field ' . $sSomeField);

or DEBUGGER('some array ' . print_r($aSomeArray,true));"

Is there another way to explain or a real-world situation/scenario that would help me see this debugging in action and better understand?

Much Thanks

 

 

 

Quote · 24 Sep 2013

       if(!empty($aSubscription['params'])) {
            $oFunction = create_function('$arg1, $arg2, $arg3', $aSubscription['params']);
            $aUnitParams = $oFunction($aParams['unit'], $aParams['action'], $aParams['object_id']);
        }

DEBUGGER('aunitparams ' .print_r($aUnitParams,true));

DEBUGGER('asubscription ' . print_r($aSubscription,true));
DEBUGGER('function unit ' . $aParams['unit'] . ' action ' . $aParams['action'] . ' object_id ' . $aParams['object_id']);
DEBUGGER('asubscription[params] ' .$aSubscription['params']);
DEBUGGER('params ' .print_r($aParams,true));
DEBUGGER('aunitparams ' .print_r($aUnitParams,true));

There ya go!  That covers it pretty good.  LOL

http://www.mytikibar.com
Quote · 24 Sep 2013

 

       if(!empty($aSubscription['params'])) {
            $oFunction = create_function('$arg1, $arg2, $arg3', $aSubscription['params']);
            $aUnitParams = $oFunction($aParams['unit'], $aParams['action'], $aParams['object_id']);
        }

DEBUGGER('aunitparams ' .print_r($aUnitParams,true));

DEBUGGER('asubscription ' . print_r($aSubscription,true));
DEBUGGER('function unit ' . $aParams['unit'] . ' action ' . $aParams['action'] . ' object_id ' . $aParams['object_id']);
DEBUGGER('asubscription[params] ' .$aSubscription['params']);
DEBUGGER('params ' .print_r($aParams,true));
DEBUGGER('aunitparams ' .print_r($aUnitParams,true));

There ya go!  That covers it pretty good.  LOL

 OK...I have no idea where or how to run that code....

I'm used to looking at logs and researching.

Forgive me for my ignorance...Does this code output to a log somehow?

Quote · 24 Sep 2013

BTW-

"If it uploads but doesn't display, I'm willing to bet when you inspect the element, the source URL is missing the extension.

Since it is, we have to poke in the code and find what routine is NOT passing the $sExt variable."

Correct me if I am wrong....Wouldn't this screenshot indicate that the extension is getting passed along correctly?

 FTP Screener

Before image number 30 (9-21-2013) there would always be the one original with it's original extension, and the rest would be jpg....Now you can see that the extension remains whatever the original image type that is uploaded.

ACTUALLY- The gifs are only generating for the "ri" whatever that is....

Image Upload Extensions.jpg · 220.4K · 1991 views
Quote · 24 Sep 2013

When you use the DEBUGGER function, look in your database at the debugger_log table.  That's where your info is posted.

The extensions are being kept when the images are created, however, when dolphins looks to display them, they are not being passed in the $sExt variable.

Right click a blank image and look at the source.  It is more than likely the hash then a .  with no extension.

So that's in the code somewhere.

<div style="background-image: url('http://www.mytikibar.com/photos/get_image/browse/0dd84c59cb82ed2b4eff4ba076947801.jpg');" class="sys_file_search_pic bx_photos_file_search_pic">
   
    <a href="http://www.mytikibar.com/photos/view/fish"><img src="http://www.mytikibar.com/templates/base/images/icons/spacer.gif"></a>
</div>

There's a function in BxPhotosModules.php called actionGetImage

and in BxPhotosSearch.php called serviceGetImage

 

function serviceGetImage ($aImageInfo, $sImgType = 'thumb') {
        $iPicID = (int)$aImageInfo['Avatar'];                               
        $aImg   = $this->_getImageFullInfo($iPicID, $sImgType);
 
  DEBUGGER(print_r($aImg,true));
 

add the DEBUGGER line and look in your debugger_log

make SURE there is a parameter $aImg['Ext']  and it holds the extension.

if not, you need to go to function _getImageFullInfo and find out why it's not getting the extension.

Just trace the routines backwards and use DEBUGGER to post the variables until you find the issue.

If you get ['ext'] it is DIFFERENT than ['Ext'] and that will be why they don't display.

 

http://www.mytikibar.com
Quote · 24 Sep 2013

OK- that makes better sense :)

Not saying I got it all soaked-up...But that moves me forward a bit- Much Thanks Steve for taking the time.

OK, I'm going to go back through and carefully apply the changes one by one and test again...

FYI-

The very last step of your instructions have to be done differently for 7.1.4-

Your instructions:

around line 662 find
        $aUnit = array(
            'switchWidth' => $iWidth,
            'switchWidthOut' => $iWidth + 4,
            'imgWidth' => strlen($aAddElems['imgWidth']) > 0 ? $aAddElems['imgWidth']: '',
            'picUrl' => $this->getImgUrl($aData['Hash'], 'file'),

  change to
###
#SteveSoft
#09-21-2013
#

        $aUnit = array(
            'switchWidth' => $iWidth,
            'switchWidthOut' => $iWidth + 4,
            'imgWidth' => strlen($aAddElems['imgWidth']) > 0 ? $aAddElems['imgWidth']: '',
            'picUrl' => $this->getImgUrl($aData['Hash'], 'file',$aData['Ext']),
and that should do it!

Here is what the 7.1.4 code actually looks like for that function-

    function getSwitcherUnit (&$aData, $aShowParams = array(), $aAddElems = array())
    {
        if (!is_array($aData))
            return;

        $iPhotoWidth = (int)$this->oModule->_oConfig->getGlParam('file_width') ? (int)$this->oModule->_oConfig->getGlParam('file_width') : 602;
        $iWidth = (int)$aAddElems['switchWidth'] > 0 ? (int)$aAddElems['switchWidth'] : $iPhotoWidth;
        $sImgUrl = $this->getCurrentUrl('file', $aData['id'], $aData['uri']);
        $aUnit = array(
            'switchWidth' => $iWidth,
            'imgWidth' => !empty($aAddElems['imgWidth']) ? $aAddElems['imgWidth']: '',
            'picUrl' => $this->getImgUrl($aData['Hash'], 'file'),
            'href' => isset($aShowParams['linkUnitTo']) && !empty($aShowParams['linkUnitTo']) ? $aShowParams['linkUnitTo'] : $sImgUrl,
            'bx_if:href' => array(
                'condition' => (int)$aShowParams['showLink'] != 0,
                'content' => array(
                    'href' => $sImgUrl,
                    'title' => $aData['title']
                )
            ),

And the changes I made-

    function getSwitcherUnit (&$aData, $aShowParams = array(), $aAddElems = array())
    {
        if (!is_array($aData))
            return;

        $iPhotoWidth = (int)$this->oModule->_oConfig->getGlParam('file_width') ? (int)$this->oModule->_oConfig->getGlParam('file_width') : 602;
        $iWidth = (int)$aAddElems['switchWidth'] > 0 ? (int)$aAddElems['switchWidth'] : $iPhotoWidth;
        $sImgUrl = $this->getCurrentUrl('file', $aData['id'], $aData['uri']);
        $aUnit = array(
            'switchWidth' => $iWidth,
            'imgWidth' => !empty($aAddElems['imgWidth']) ? $aAddElems['imgWidth']: '',
            'picUrl' => $this->getImgUrl($aData['Hash'], 'file',$aData['Ext']),
            'href' => isset($aShowParams['linkUnitTo']) && !empty($aShowParams['linkUnitTo']) ? $aShowParams['linkUnitTo'] : $sImgUrl,
            'bx_if:href' => array(
                'condition' => (int)$aShowParams['showLink'] != 0,
                'content' => array(
                    'href' => $sImgUrl,
                    'title' => $aData['title']
                )
            ),

Is this how you would have done this?

OK, Going to go back through this again and see what we get :)

Quote · 24 Sep 2013

I would add the bold code and see what the debugger_log shows you for $aData and make sure $aData['Ext'] exists.

If it's $aData['ext'] you have to do this

$aData['Ext'] = $aData['ext'];

also, make sure $aData['Ext'] contains the extension.

  $sImgUrl = $this->getCurrentUrl('file', $aData['id'], $aData['uri']);

DEBUGGER(print_r($aData,true);
        $aUnit = array(

http://www.mytikibar.com
Quote · 24 Sep 2013

Sorry- finally got a bit of time to work on this more...

OK....Steve, you said-

There's a function in BxPhotosModules.php called actionGetImage

 

and in BxPhotosSearch.php called serviceGetImage

 

function serviceGetImage ($aImageInfo, $sImgType = 'thumb') {
        $iPicID = (int)$aImageInfo['Avatar'];                               
        $aImg   = $this->_getImageFullInfo($iPicID, $sImgType);
 
  DEBUGGER(print_r($aImg,true));

 

add the DEBUGGER line and look in your debugger_log

 

make SURE there is a parameter $aImg['Ext']  and it holds the extension.

 

if not, you need to go to function _getImageFullInfo and find out why it's not getting the extension.

 

Just trace the routines backwards and use DEBUGGER to post the variables until you find the issue.

 

If you get ['ext'] it is DIFFERENT than ['Ext'] and that will be why they don't display.

Here is the results for that-

debugger screener

So yeah, it's not passing along the extension and is showing ext instead of EXT just as you figured....

Not sure where to go from here....Does the screener help you?


debugger-1.jpg · 173K · 1989 views
Quote · 26 Sep 2013

go to _getImageFullInfo

   function _getImageFullInfo($iId, $sType = 'thumb') {
        // predefined sizes
        $aType2Image = array(
            'thumb' => 64, 'icon' => 32, 'file' => 600, 'browse' => 250, 'original' => 0
        );
        $aImageInfo = $this->_getImageDbInfo($iId);

After that add this.

DEBUGGER(print_r($aImageInfo,true));

See if you get $aImageInfo['ext']  or $aImageInfo['Ext']

if you get $aImageInfo['ext'] and no $aImageInfo['Ext']

remove the DEBUGGER line and add this...

if (!$aImageInfo['Ext'] )
        $aImageInfo['Ext'] = $aImageInfo['ext'];

If you don't get either, then we need to investigate  function _getImageDbInfo


http://www.mytikibar.com
Quote · 26 Sep 2013

OK Steve....

go to _getImageFullInfo

   function _getImageFullInfo($iId, $sType = 'thumb') {
        // predefined sizes
        $aType2Image = array(
            'thumb' => 64, 'icon' => 32, 'file' => 600, 'browse' => 250, 'original' => 0
        );
        $aImageInfo = $this->_getImageDbInfo($iId);

After that add this.

DEBUGGER(print_r($aImageInfo,true));


Gives me this-

debugger2

debugger-2.jpg · 156.8K · 1885 views
Quote · 26 Sep 2013

so add this

if (!$aImageInfo['Ext'] )
        $aImageInfo['Ext'] = $aImageInfo['ext'];


You are getting back $aImageInfo['ext'] which is a lower case e

http://www.mytikibar.com
Quote · 26 Sep 2013

Been tied-up with other projects....

Will try to get back to this asap.

Quote · 6 Oct 2013

I tried you code on 7.1.4 Steve and cannot seem to get it working ... infact the code broke my test site :/

is there any updated way of having flash / animated gifs working ?

DedicatedServer4You.com -- BIGGEST Range of Dedicated Servers at the Lowest Price!
Quote · 26 Nov 2013

If you give me more specifics, I might be able to help you out.  I am staying with  7.0.9 because of years of mods.

Look thru this article and create the DEBUGGER function and we can start trouble shooting.

http://www.mytikibar.com
Quote · 27 Nov 2013

 this part is different on my files:-

$aPics = $this->oModule->oAlbums->getAlbumCoverFiles($iAlbumId, array('table'=>$this->aCurrent['table'], 'field'=>'ID', 'fields_list'=>array('Hash')), array(array('field'=>'Status', 'value'=>'approved')), $iLimit);

 

around line 118 find

        $aPics = $this->oModule->oAlbums->getAlbumCoverFiles($iAlbumId, array('table'=>$this->aCurrent['table'], 'field'=>'ID', 'fields_list'=>array('Hash')), array(array('field'=>'Status', 'value'=>'approved')));

DedicatedServer4You.com -- BIGGEST Range of Dedicated Servers at the Lowest Price!
Quote · 27 Nov 2013

 

'fields_list'=>array('Hash')),

 you can still change:

'fields_list'=>array('Hash','Ext'))

and see what happens.  We are trying to pass 'Ext' to all functions so  they images will display right.

'Ext' contains the extension of the filename whether it be GIF, JPG, or PNG

http://www.mytikibar.com
Quote · 28 Nov 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.