Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
BRIC
dokuwiki
Commits
e582e8b6
Commit
e582e8b6
authored
17 years ago
by
s_wienecke
Browse files
Options
Downloads
Patches
Plain Diff
transparent_gif
darcs-hash:20071221181419-3d7ce-f05705a0357412a87e7984a041ac5812eea83048.gz
parent
ff8e5c09
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/exe/fetch.php
+21
-1
21 additions, 1 deletion
lib/exe/fetch.php
with
21 additions
and
1 deletion
lib/exe/fetch.php
+
21
−
1
View file @
e582e8b6
...
...
@@ -324,6 +324,7 @@ function resize_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){
* resize images using PHP's libGD support
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Sebastian Wienecke <s_wienecke@web.de>
*/
function
resize_imageGD
(
$ext
,
$from
,
$from_w
,
$from_h
,
$to
,
$to_w
,
$to_h
){
global
$conf
;
...
...
@@ -349,7 +350,7 @@ function resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){
}
if
(
!
$image
)
return
false
;
if
((
$conf
[
'gdlib'
]
>
1
)
&&
function_exists
(
"imagecreatetruecolor"
)){
if
((
$conf
[
'gdlib'
]
>
1
)
&&
function_exists
(
"imagecreatetruecolor"
)
&&
$ext
!=
'gif'
){
$newimg
=
@
imagecreatetruecolor
(
$to_w
,
$to_h
);
}
if
(
!
$newimg
)
$newimg
=
@
imagecreate
(
$to_w
,
$to_h
);
...
...
@@ -364,6 +365,25 @@ function resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){
imagesavealpha
(
$newimg
,
true
);
}
//keep gif transparent color if possible
if
(
$ext
==
'gif'
&&
function_exists
(
'imagefill'
)
&&
function_exists
(
'imagecolorallocate'
))
{
if
(
function_exists
(
'imagecolorsforindex'
)
&&
function_exists
(
'imagecolortransparent'
))
{
$transcolorindex
=
@
imagecolortransparent
(
$image
);
if
(
$transcolorindex
>=
0
)
{
//transparent color exists
$transcolor
=
@
imagecolorsforindex
(
$image
,
$transcolorindex
);
$transcolorindex
=
@
imagecolorallocate
(
$newimg
,
$transcolor
[
'red'
],
$transcolor
[
'green'
],
$transcolor
[
'blue'
]);
@
imagefill
(
$newimg
,
0
,
0
,
$transcolorindex
);
@
imagecolortransparent
(
$newimg
,
$transcolorindex
);
}
else
{
//filling with white
$whitecolorindex
=
@
imagecolorallocate
(
$newimg
,
255
,
255
,
255
);
@
imagefill
(
$newimg
,
0
,
0
,
$whitecolorindex
);
}
}
else
{
//filling with white
$whitecolorindex
=
@
imagecolorallocate
(
$newimg
,
255
,
255
,
255
);
@
imagefill
(
$newimg
,
0
,
0
,
$whitecolorindex
);
}
}
//try resampling first
if
(
function_exists
(
"imagecopyresampled"
)){
if
(
!@
imagecopyresampled
(
$newimg
,
$image
,
0
,
0
,
0
,
0
,
$to_w
,
$to_h
,
$from_w
,
$from_h
))
{
...
...
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