Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17260 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 17260 Rev 17292
Línea 1... Línea 1...
1
<?php
1
<?php
-
 
2
 
2
namespace LeadersLinked\Library;
3
namespace LeadersLinked\Library;
Línea 3... Línea 4...
3
 
4
 
4
use LeadersLinked\Model\User;
5
use LeadersLinked\Model\User;
5
use LeadersLinked\Model\UserProfile;
6
use LeadersLinked\Model\UserProfile;
6
use LeadersLinked\Model\Company;
7
use LeadersLinked\Model\Company;
Línea 7... Línea 8...
7
use LeadersLinked\Model\Group;
8
use LeadersLinked\Model\Group;
8
 
9
 
Línea 9... Línea 10...
9
class Storage 
10
class Storage
Línea 10... Línea 11...
10
{
11
{
Línea 905... Línea 906...
905
            $storageFileMapper->insert($storageFile);
906
            $storageFileMapper->insert($storageFile);
906
        }
907
        }
Línea 907... Línea 908...
907
 
908
 
908
 
909
 
909
        $url = 'https://' . $_SERVER['SERVER_NAME'] . '/storage/' . $code;
910
        $url = 'https://' . $_SERVER['SERVER_NAME'] . '/storage/' . $code;
910
        
911
 
Línea 911... Línea 912...
911
        return $url;
912
        return $url;
912
    }
913
    }
Línea 1040... Línea 1041...
1040
 
1041
 
1041
    /**
1042
    /**
1042
     *
1043
     *
1043
     * @param string $source
1044
     * @param string $source
1044
     * @param string $target_filename
1045
     * @param string $target_filename
1045
     * @param number $target_width
1046
     * @param int $target_width
1046
     * @param number $target_height
1047
     * @param int $target_height
1047
     * @return boolean
1048
     * @return boolean
1048
     */
1049
     */
1049
    public function uploadImageResize($source_filename, $target_filename, $target_width, $target_height)
1050
    public function uploadImageResize($source_filename, $target_filename, $target_width, $target_height)
1050
    {
1051
    {
Línea 1089... Línea 1090...
1089
            if (isset($img) && ($img instanceof \GdImage || is_resource($img))) {
1090
            if (isset($img) && ($img instanceof \GdImage || is_resource($img))) {
1090
                imagedestroy($img);
1091
                imagedestroy($img);
1091
            }
1092
            }
1092
            if (isset($new_image) && ($new_image instanceof \GdImage || is_resource($new_image))) {
1093
            if (isset($new_image) && ($new_image instanceof \GdImage || is_resource($new_image))) {
1093
                imagedestroy($new_image);
1094
                imagedestroy($new_image);
1094
            } 
1095
            }
1095
            if (isset($source_filename) && file_exists($source_filename)) {
1096
            if (isset($source_filename) && file_exists($source_filename)) {
1096
                 unlink($source_filename);
1097
                unlink($source_filename);
1097
            }
1098
            }
1098
            return false;
1099
            return false;
1099
        }
1100
        }
1100
    }
1101
    }
Línea 1183... Línea 1184...
1183
                if ($new_image === false) {
1184
                if ($new_image === false) {
1184
                    imagedestroy($img);
1185
                    imagedestroy($img);
1185
                    unlink($source_filename);
1186
                    unlink($source_filename);
1186
                    return false;
1187
                    return false;
1187
                }
1188
                }
1188
                
1189
 
1189
                imageCopyResampled($new_image, $img, 0, 0, 0, 0, $source_width, $source_height, $source_width, $source_height);
1190
                imageCopyResampled($new_image, $img, 0, 0, 0, 0, $source_width, $source_height, $source_width, $source_height);
1190
                imagedestroy($img);
1191
                imagedestroy($img);
Línea 1191... Línea 1192...
1191
 
1192
 
1192
                return $this->_savePngAndCleanup($new_image, $target_filename, $source_filename);
1193
                return $this->_savePngAndCleanup($new_image, $target_filename, $source_filename);
Línea 1278... Línea 1279...
1278
            '---',
1279
            '---',
1279
            '--'
1280
            '--'
1280
        ], '-', $str);
1281
        ], '-', $str);
1281
        return trim(strtolower($str));
1282
        return trim(strtolower($str));
1282
    }
1283
    }
1283
}
-
 
1284
1284
}
-
 
1285