Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
aeefe48c
Commit
aeefe48c
authored
Nov 22, 2013
by
Björn Schießle
Browse files
Options
Downloads
Patches
Plain Diff
Revert "use relative paths to create images from a file. This way it also works if"
This reverts commit
3488f0b7
.
parent
3b904647
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/image.php
+15
-16
15 additions, 16 deletions
lib/private/image.php
with
15 additions
and
16 deletions
lib/private/image.php
+
15
−
16
View file @
aeefe48c
...
@@ -414,61 +414,60 @@ class OC_Image {
...
@@ -414,61 +414,60 @@ class OC_Image {
*/
*/
public
function
loadFromFile
(
$imagePath
=
false
)
{
public
function
loadFromFile
(
$imagePath
=
false
)
{
// exif_imagetype throws "read error!" if file is less than 12 byte
// exif_imagetype throws "read error!" if file is less than 12 byte
$absPath
=
\OC\Files\Filesystem
::
getLocalFile
(
$imagePath
);
if
(
!@
is_file
(
$imagePath
)
||
!
file_exists
(
$imagePath
)
||
filesize
(
$imagePath
)
<
12
||
!
is_readable
(
$imagePath
))
{
if
(
!@
is_file
(
$absPath
)
||
!
file_exists
(
$absPath
)
||
filesize
(
$absPath
)
<
12
||
!
is_readable
(
$absPath
))
{
// Debug output disabled because this method is tried before loadFromBase64?
// Debug output disabled because this method is tried before loadFromBase64?
OC_Log
::
write
(
'core'
,
'OC_Image->loadFromFile, couldn\'t load: '
.
$
abs
Path
,
OC_Log
::
DEBUG
);
OC_Log
::
write
(
'core'
,
'OC_Image->loadFromFile, couldn\'t load: '
.
$
image
Path
,
OC_Log
::
DEBUG
);
return
false
;
return
false
;
}
}
$iType
=
exif_imagetype
(
$
abs
Path
);
$iType
=
exif_imagetype
(
$
image
Path
);
switch
(
$iType
)
{
switch
(
$iType
)
{
case
IMAGETYPE_GIF
:
case
IMAGETYPE_GIF
:
if
(
imagetypes
()
&
IMG_GIF
)
{
if
(
imagetypes
()
&
IMG_GIF
)
{
$this
->
resource
=
imagecreatefromgif
(
$
abs
Path
);
$this
->
resource
=
imagecreatefromgif
(
$
image
Path
);
}
else
{
}
else
{
OC_Log
::
write
(
'core'
,
OC_Log
::
write
(
'core'
,
'OC_Image->loadFromFile, GIF images not supported: '
.
$
abs
Path
,
'OC_Image->loadFromFile, GIF images not supported: '
.
$
image
Path
,
OC_Log
::
DEBUG
);
OC_Log
::
DEBUG
);
}
}
break
;
break
;
case
IMAGETYPE_JPEG
:
case
IMAGETYPE_JPEG
:
if
(
imagetypes
()
&
IMG_JPG
)
{
if
(
imagetypes
()
&
IMG_JPG
)
{
$this
->
resource
=
imagecreatefromjpeg
(
$
abs
Path
);
$this
->
resource
=
imagecreatefromjpeg
(
$
image
Path
);
}
else
{
}
else
{
OC_Log
::
write
(
'core'
,
OC_Log
::
write
(
'core'
,
'OC_Image->loadFromFile, JPG images not supported: '
.
$
abs
Path
,
'OC_Image->loadFromFile, JPG images not supported: '
.
$
image
Path
,
OC_Log
::
DEBUG
);
OC_Log
::
DEBUG
);
}
}
break
;
break
;
case
IMAGETYPE_PNG
:
case
IMAGETYPE_PNG
:
if
(
imagetypes
()
&
IMG_PNG
)
{
if
(
imagetypes
()
&
IMG_PNG
)
{
$this
->
resource
=
imagecreatefrompng
(
$
abs
Path
);
$this
->
resource
=
imagecreatefrompng
(
$
image
Path
);
}
else
{
}
else
{
OC_Log
::
write
(
'core'
,
OC_Log
::
write
(
'core'
,
'OC_Image->loadFromFile, PNG images not supported: '
.
$
abs
Path
,
'OC_Image->loadFromFile, PNG images not supported: '
.
$
image
Path
,
OC_Log
::
DEBUG
);
OC_Log
::
DEBUG
);
}
}
break
;
break
;
case
IMAGETYPE_XBM
:
case
IMAGETYPE_XBM
:
if
(
imagetypes
()
&
IMG_XPM
)
{
if
(
imagetypes
()
&
IMG_XPM
)
{
$this
->
resource
=
imagecreatefromxbm
(
$
abs
Path
);
$this
->
resource
=
imagecreatefromxbm
(
$
image
Path
);
}
else
{
}
else
{
OC_Log
::
write
(
'core'
,
OC_Log
::
write
(
'core'
,
'OC_Image->loadFromFile, XBM/XPM images not supported: '
.
$
abs
Path
,
'OC_Image->loadFromFile, XBM/XPM images not supported: '
.
$
image
Path
,
OC_Log
::
DEBUG
);
OC_Log
::
DEBUG
);
}
}
break
;
break
;
case
IMAGETYPE_WBMP
:
case
IMAGETYPE_WBMP
:
if
(
imagetypes
()
&
IMG_WBMP
)
{
if
(
imagetypes
()
&
IMG_WBMP
)
{
$this
->
resource
=
imagecreatefromwbmp
(
$
abs
Path
);
$this
->
resource
=
imagecreatefromwbmp
(
$
image
Path
);
}
else
{
}
else
{
OC_Log
::
write
(
'core'
,
OC_Log
::
write
(
'core'
,
'OC_Image->loadFromFile, WBMP images not supported: '
.
$
abs
Path
,
'OC_Image->loadFromFile, WBMP images not supported: '
.
$
image
Path
,
OC_Log
::
DEBUG
);
OC_Log
::
DEBUG
);
}
}
break
;
break
;
case
IMAGETYPE_BMP
:
case
IMAGETYPE_BMP
:
$this
->
resource
=
$this
->
imagecreatefrombmp
(
$
abs
Path
);
$this
->
resource
=
$this
->
imagecreatefrombmp
(
$
image
Path
);
break
;
break
;
/*
/*
case IMAGETYPE_TIFF_II: // (intel byte order)
case IMAGETYPE_TIFF_II: // (intel byte order)
...
@@ -497,7 +496,7 @@ class OC_Image {
...
@@ -497,7 +496,7 @@ class OC_Image {
default
:
default
:
// this is mostly file created from encrypted file
// this is mostly file created from encrypted file
$this
->
resource
=
imagecreatefromstring
(
\OC\Files\Filesystem
::
file_get_contents
(
$imagePath
));
$this
->
resource
=
imagecreatefromstring
(
\OC\Files\Filesystem
::
file_get_contents
(
\OC\Files\Filesystem
::
getLocalPath
(
$imagePath
))
)
;
$iType
=
IMAGETYPE_PNG
;
$iType
=
IMAGETYPE_PNG
;
OC_Log
::
write
(
'core'
,
'OC_Image->loadFromFile, Default'
,
OC_Log
::
DEBUG
);
OC_Log
::
write
(
'core'
,
'OC_Image->loadFromFile, Default'
,
OC_Log
::
DEBUG
);
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment