0 Members and 1 Guest are viewing this topic.

*

Benoitc64

  • **
  • 72
  • osDate Version: osDate Evo v1.2
Autogenprofile error
« on: April 25, 2018, 06:46:27 AM »
First thanks for the good job for osdate evo 1.3 in php 7.

When we generate profile with photo stored in directory instead of database
I have this error:  See the attachment

and i found that the directory is empty and the image profiles is generate at the wrong place
so I search and found why

i modifiy the
libs/modOsDate/modplugins.php

line 2902

    function modWriteImageToFile($img, $userid, $picno, $file) {
        if ($file == '') {
            $filename= time().$userid.$picno.'.jpg';
        } else {
            $filename = $file;
        }

        $img = imagecreatefromstring($img);
      mkdir(USER_IMAGE_DIR.$userid,0700);
        imagejpeg($img, USER_IMAGE_DIR.$userid.'/'.$filename);
        return ($filename);
    }

and that's work
osDateEvo v1.2 | PHP 5.6.30-0+deb8u1 | MySQL: 5.5.51 |

*

Pharg

  • *****
  • 3,069
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Autogenprofile error
« Reply #1 on: April 25, 2018, 07:09:07 AM »
Hi Benoitc64,

Thanks for that fix, will check it out soon.

Is this in PHP 7 or PHP 5.6?
« Last Edit: April 25, 2018, 07:32:28 AM by Pharg »
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.1.15 | MySQL: 5.5.35

*

Pharg

  • *****
  • 3,069
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Autogenprofile error
« Reply #2 on: April 25, 2018, 11:38:35 AM »
Hi Benoitc64,

Works great but going to have to find another method to this fix, as it now gives PHP Warnings in the error log  :(

PHP Warning:  mkdir(): File exists in /domain.com/libs/modOsDate/modPlugin.php on line 2902
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.1.15 | MySQL: 5.5.35

*

Benoitc64

  • **
  • 72
  • osDate Version: osDate Evo v1.2
Re: Autogenprofile error
« Reply #3 on: April 25, 2018, 05:17:42 PM »
but we are on the right way. I will check it to make it better.
osDateEvo v1.2 | PHP 5.6.30-0+deb8u1 | MySQL: 5.5.51 |

*

Benoitc64

  • **
  • 72
  • osDate Version: osDate Evo v1.2
Re: Autogenprofile error
« Reply #4 on: April 28, 2018, 05:53:05 AM »
Hi

I've correct the script.
Sorry that's was my mistake.

In libs/modOsDate/modPlugins.php

find the function modWriteImageToFile and replace by

Code: [Select]
    function modWriteImageToFile($img, $userid, $picno, $file) {
        if ($file == '') {
            $filename= time().$userid.$picno.'.jpg';
        } else {
            $filename = $file;
        }

        $img = imagecreatefromstring($img);
        $directory = USER_IMAGE_DIR . $userid;
        if (!is_dir($directory)){
             mkdir($directory);
         }



        imagejpeg($img, USER_IMAGE_DIR . $userid . '/' . $filename);
imagedestroy($img);
        return ($filename);
    }


osDateEvo v1.2 | PHP 5.6.30-0+deb8u1 | MySQL: 5.5.51 |

*

Pharg

  • *****
  • 3,069
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Autogenprofile error
« Reply #5 on: April 28, 2018, 07:01:47 AM »
Hi Benoitc64,


Thanks I will look at sometime later.

You can find further code and how it was done in the snaps_functions.php if we still get warnings in PHP 7
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.1.15 | MySQL: 5.5.35