Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
e6697c32
Commit
e6697c32
authored
8 years ago
by
Charles Benke
Committed by
Laurent Destailleur
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update images.lib.php
in fact $dir is not used in the function Conflicts: htdocs/core/lib/images.lib.php
parent
1add34b4
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
htdocs/core/lib/images.lib.php
+22
-22
22 additions, 22 deletions
htdocs/core/lib/images.lib.php
with
22 additions
and
22 deletions
htdocs/core/lib/images.lib.php
+
22
−
22
View file @
e6697c32
...
@@ -74,16 +74,18 @@ function dol_getImageSize($file, $url = false)
...
@@ -74,16 +74,18 @@ function dol_getImageSize($file, $url = false)
if
(
image_format_supported
(
$file
)
<
0
)
return
$ret
;
if
(
image_format_supported
(
$file
)
<
0
)
return
$ret
;
$fi
chier
=
$file
;
$fi
letoread
=
$file
;
if
(
!
$url
)
if
(
!
$url
)
{
{
$fichier
=
realpath
(
$file
);
// Chemin canonique absolu de l'image
$filetoread
=
realpath
(
dol_osencode
(
$file
));
// Chemin canonique absolu de l'image
$dir
=
dirname
(
$file
);
// Chemin du dossier contenant l'image
}
}
$infoImg
=
getimagesize
(
$fichier
);
// Recuperation des infos de l'image
if
(
$filetoread
)
{
$infoImg
=
getimagesize
(
$filetoread
);
// Recuperation des infos de l'image
$ret
[
'width'
]
=
$infoImg
[
0
];
// Largeur de l'image
$ret
[
'width'
]
=
$infoImg
[
0
];
// Largeur de l'image
$ret
[
'height'
]
=
$infoImg
[
1
];
// Hauteur de l'image
$ret
[
'height'
]
=
$infoImg
[
1
];
// Hauteur de l'image
}
return
$ret
;
return
$ret
;
}
}
...
@@ -139,10 +141,9 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s
...
@@ -139,10 +141,9 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s
return
'Both newHeight or newWidth must be defined for croping'
;
return
'Both newHeight or newWidth must be defined for croping'
;
}
}
$fichier
=
realpath
(
$file
);
// Chemin canonique absolu de l'image
$filetoread
=
realpath
(
dol_osencode
(
$file
));
// Chemin canonique absolu de l'image
$dir
=
dirname
(
$file
);
// Chemin du dossier contenant l'image
$infoImg
=
getimagesize
(
$fi
chier
);
// Recuperation des infos de l'image
$infoImg
=
getimagesize
(
$fi
letoread
);
// Recuperation des infos de l'image
$imgWidth
=
$infoImg
[
0
];
// Largeur de l'image
$imgWidth
=
$infoImg
[
0
];
// Largeur de l'image
$imgHeight
=
$infoImg
[
1
];
// Hauteur de l'image
$imgHeight
=
$infoImg
[
1
];
// Hauteur de l'image
...
@@ -187,22 +188,22 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s
...
@@ -187,22 +188,22 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s
switch
(
$infoImg
[
2
])
switch
(
$infoImg
[
2
])
{
{
case
1
:
// Gif
case
1
:
// Gif
$img
=
imagecreatefromgif
(
$fi
chier
);
$img
=
imagecreatefromgif
(
$fi
letoread
);
$extImg
=
'.gif'
;
// File name extension of image
$extImg
=
'.gif'
;
// File name extension of image
$newquality
=
'NU'
;
// Quality is not used for this format
$newquality
=
'NU'
;
// Quality is not used for this format
break
;
break
;
case
2
:
// Jpg
case
2
:
// Jpg
$img
=
imagecreatefromjpeg
(
$fi
chier
);
$img
=
imagecreatefromjpeg
(
$fi
letoread
);
$extImg
=
'.jpg'
;
$extImg
=
'.jpg'
;
$newquality
=
100
;
// % quality maximum
$newquality
=
100
;
// % quality maximum
break
;
break
;
case
3
:
// Png
case
3
:
// Png
$img
=
imagecreatefrompng
(
$fi
chier
);
$img
=
imagecreatefrompng
(
$fi
letoread
);
$extImg
=
'.png'
;
$extImg
=
'.png'
;
$newquality
=
0
;
// No compression (0-9)
$newquality
=
0
;
// No compression (0-9)
break
;
break
;
case
4
:
// Bmp
case
4
:
// Bmp
$img
=
imagecreatefromwbmp
(
$fi
chier
);
$img
=
imagecreatefromwbmp
(
$fi
letoread
);
$extImg
=
'.bmp'
;
$extImg
=
'.bmp'
;
$newquality
=
'NU'
;
// Quality is not used for this format
$newquality
=
'NU'
;
// Quality is not used for this format
break
;
break
;
...
@@ -383,10 +384,9 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
...
@@ -383,10 +384,9 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
return
'Error: Wrong value for parameter maxHeight'
;
return
'Error: Wrong value for parameter maxHeight'
;
}
}
$fichier
=
realpath
(
$file
);
// Chemin canonique absolu de l'image
$filetoread
=
realpath
(
dol_osencode
(
$file
));
// Chemin canonique absolu de l'image
$dir
=
dirname
(
$file
);
// Chemin du dossier contenant l'image
$infoImg
=
getimagesize
(
$fi
chier
);
// Recuperation des infos de l'image
$infoImg
=
getimagesize
(
$fi
letoread
);
// Recuperation des infos de l'image
$imgWidth
=
$infoImg
[
0
];
// Largeur de l'image
$imgWidth
=
$infoImg
[
0
];
// Largeur de l'image
$imgHeight
=
$infoImg
[
1
];
// Hauteur de l'image
$imgHeight
=
$infoImg
[
1
];
// Hauteur de l'image
...
@@ -430,22 +430,22 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
...
@@ -430,22 +430,22 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
}
}
// On cree le repertoire contenant les vignettes
// On cree le repertoire contenant les vignettes
$dirthumb
=
$
dir
.
(
$outdir
?
'/'
.
$outdir
:
''
);
// Chemin du dossier contenant les vignettes
$dirthumb
=
dir
name
(
$file
)
.
(
$outdir
?
'/'
.
$outdir
:
''
);
// Chemin du dossier contenant les vignettes
dol_mkdir
(
$dirthumb
);
dol_mkdir
(
$dirthumb
);
// Initialisation des variables selon l'extension de l'image
// Initialisation des variables selon l'extension de l'image
switch
(
$infoImg
[
2
])
switch
(
$infoImg
[
2
])
{
{
case
IMAGETYPE_GIF
:
// 1
case
IMAGETYPE_GIF
:
// 1
$img
=
imagecreatefromgif
(
$fi
chier
);
$img
=
imagecreatefromgif
(
$fi
letoread
);
$extImg
=
'.gif'
;
// Extension de l'image
$extImg
=
'.gif'
;
// Extension de l'image
break
;
break
;
case
IMAGETYPE_JPEG
:
// 2
case
IMAGETYPE_JPEG
:
// 2
$img
=
imagecreatefromjpeg
(
$fi
chier
);
$img
=
imagecreatefromjpeg
(
$fi
letoread
);
$extImg
=
(
preg_match
(
'/\.jpeg$/'
,
$file
)
?
'.jpeg'
:
'.jpg'
);
// Extension de l'image
$extImg
=
(
preg_match
(
'/\.jpeg$/'
,
$file
)
?
'.jpeg'
:
'.jpg'
);
// Extension de l'image
break
;
break
;
case
IMAGETYPE_PNG
:
// 3
case
IMAGETYPE_PNG
:
// 3
$img
=
imagecreatefrompng
(
$fi
chier
);
$img
=
imagecreatefrompng
(
$fi
letoread
);
$extImg
=
'.png'
;
$extImg
=
'.png'
;
break
;
break
;
case
IMAGETYPE_BMP
:
// 6
case
IMAGETYPE_BMP
:
// 6
...
@@ -453,7 +453,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
...
@@ -453,7 +453,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
$extImg
=
'.bmp'
;
$extImg
=
'.bmp'
;
break
;
break
;
case
IMAGETYPE_WBMP
:
// 15
case
IMAGETYPE_WBMP
:
// 15
$img
=
imagecreatefromwbmp
(
$fi
chier
);
$img
=
imagecreatefromwbmp
(
$fi
letoread
);
$extImg
=
'.bmp'
;
$extImg
=
'.bmp'
;
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