php-windows Digest 8 Aug 2013 05:07:09 -0000 Issue 4129

Topics (messages 31097 through 31100):

Re: Cropping images with fading outline effects, using GD, etc.?
        31097 by: Pierre Joye
        31098 by: Jacob Kruger
        31099 by: Jacob Kruger

Re: php can't resolve 8.3 paths to unicode filenames, is that expected ?
        31100 by: Pierre Joye

Administrivia:

To subscribe to the digest, e-mail:
        php-windows-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-windows-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-wind...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
hi!

Can you post a link to an image showing what you like to achieve? With
the src image?

Thanks!

On Wed, Aug 7, 2013 at 9:46 AM, Jacob Kruger <ja...@blindza.co.za> wrote:
> I need/want to be able to take either uploaded, or stored image files, and 
> crop them into either rectangular, or elliptical pieces/shapes, and am using 
> GD library thus far.
>
> The basics are not an issue - for rectangular cropping, imagecopy and 
> imagecopyresize, etc. are functions that can handle it easily enough, and in 
> terms of elliptical cropping, I am drawing an elliptical shape onto the 
> original image using a colour that's unlikely to be part of the original 
> image resource, with drawing line thickness set to 2 pixels for now, and then 
> I do a form of flood fill to border with that same colour outside the 
> ellipsis, and then set that as the transparent colour of the image, before 
> copying the relevant part to another image resource as well.
>
> However, it now comes down to that the images to be saved might also need to 
> have sort of faded/increasingly transparent outlines, and these would 
> generally be photo's, and so, just choosing a single transparent colour won't 
> really work too well.
>
> Was thinking simplest will be to in fact take multiple instances of each 
> image, with each of them going slightly smaller in terms of width/height, and 
> then I could keep them centred on each other, but sort of overlay them with 
> the most transparent/faded/widest image instance starting from back, and with 
> sort of original colouration/narrowest one being applied to output resource 
> last, and this should implement a form of faded/blurred outline/edging to 
> output image?
>
> However, it again comes down to trying to decide on best/simplest way to 
> apply a form of global transparency filter to an image resource, without 
> needing to specify a specific colour each time for something like the 
> imagecolourtransparent function, since suppose would need to then figure out 
> a way to determine which RGB value would work best per image - and don't 
> think that could be made to work consistently either.
>
> In other words, what am really looking for at moment is a way to set the 
> opacity of an image resource - and if it comes down to capturing the output 
> buffer while using something like imagepng to stream the image resource to 
> the buffer, that's not an issue either since am already using a form of that 
> to sometimes capture image resource data in another way, but, would need to 
> find a way to somehow affect opacity of output stream image then as well.
>
> While I am currently pretty much just using GD library, I would be open to 
> other suggestions/workarounds/thoughts on the simplest way to implement 
> something like this?
>
> And, if I'm just missing, or haven't come across a simple way to implement 
> faded/graded outlines for images, would also like to know that...<smile>
>
> TIA
>
> Jacob Kruger
> Blind Biker
> Skype: BlindZA
> '...fate had broken his body, but not his spirit...'



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

--- End Message ---
--- Begin Message --- For example, the following imagick function might handle output image opacity setting, but, it would still be nice to just handle outline gradual fading on one go:
http://www.php.net/manual/en/imagick.setimageopacity.php

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- From: "Jacob Kruger" <ja...@blindza.co.za>
To: <php-wind...@lists.php.net>
Sent: Wednesday, August 07, 2013 9:46 AM
Subject: [PHP-WIN] Cropping images with fading outline effects, using GD, etc.?


I need/want to be able to take either uploaded, or stored image files, and crop them into either rectangular, or elliptical pieces/shapes, and am using GD library thus far.

The basics are not an issue - for rectangular cropping, imagecopy and imagecopyresize, etc. are functions that can handle it easily enough, and in terms of elliptical cropping, I am drawing an elliptical shape onto the original image using a colour that's unlikely to be part of the original image resource, with drawing line thickness set to 2 pixels for now, and then I do a form of flood fill to border with that same colour outside the ellipsis, and then set that as the transparent colour of the image, before copying the relevant part to another image resource as well.

However, it now comes down to that the images to be saved might also need to have sort of faded/increasingly transparent outlines, and these would generally be photo's, and so, just choosing a single transparent colour won't really work too well.

Was thinking simplest will be to in fact take multiple instances of each image, with each of them going slightly smaller in terms of width/height, and then I could keep them centred on each other, but sort of overlay them with the most transparent/faded/widest image instance starting from back, and with sort of original colouration/narrowest one being applied to output resource last, and this should implement a form of faded/blurred outline/edging to output image?

However, it again comes down to trying to decide on best/simplest way to apply a form of global transparency filter to an image resource, without needing to specify a specific colour each time for something like the imagecolourtransparent function, since suppose would need to then figure out a way to determine which RGB value would work best per image - and don't think that could be made to work consistently either.

In other words, what am really looking for at moment is a way to set the opacity of an image resource - and if it comes down to capturing the output buffer while using something like imagepng to stream the image resource to the buffer, that's not an issue either since am already using a form of that to sometimes capture image resource data in another way, but, would need to find a way to somehow affect opacity of output stream image then as well.

While I am currently pretty much just using GD library, I would be open to other suggestions/workarounds/thoughts on the simplest way to implement something like this?

And, if I'm just missing, or haven't come across a simple way to implement faded/graded outlines for images, would also like to know that...<smile>

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'


--- End Message ---
--- Begin Message ---
Sorry, but, I'm the wrong person to look for an example...<smile>

My guess would be that, for example, would like to, take a normal photo image of someone's upper body, and maybe cut out primarily their face, and then do something like if the radius of the complete outline picture would be like 100 pixels, then have the outer rim of esomewhere between 5-10 pixels sort of fade in from transparent to normal/standard opacity, or thereabouts, but, the person who'd uploaded it might want to be able to make some choices about sort of fade in/transition effect/detail as well..?

Thanks

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- From: "Pierre Joye" <pierre....@gmail.com>
To: "Jacob Kruger" <ja...@blindza.co.za>
Cc: "php-windows" <php-wind...@lists.php.net>
Sent: Wednesday, August 07, 2013 10:08 AM
Subject: Re: [PHP-WIN] Cropping images with fading outline effects, using GD, etc.?


hi!

Can you post a link to an image showing what you like to achieve? With
the src image?

Thanks!

On Wed, Aug 7, 2013 at 9:46 AM, Jacob Kruger <ja...@blindza.co.za> wrote:
I need/want to be able to take either uploaded, or stored image files, and crop them into either rectangular, or elliptical pieces/shapes, and am using GD library thus far.

The basics are not an issue - for rectangular cropping, imagecopy and imagecopyresize, etc. are functions that can handle it easily enough, and in terms of elliptical cropping, I am drawing an elliptical shape onto the original image using a colour that's unlikely to be part of the original image resource, with drawing line thickness set to 2 pixels for now, and then I do a form of flood fill to border with that same colour outside the ellipsis, and then set that as the transparent colour of the image, before copying the relevant part to another image resource as well.

However, it now comes down to that the images to be saved might also need to have sort of faded/increasingly transparent outlines, and these would generally be photo's, and so, just choosing a single transparent colour won't really work too well.

Was thinking simplest will be to in fact take multiple instances of each image, with each of them going slightly smaller in terms of width/height, and then I could keep them centred on each other, but sort of overlay them with the most transparent/faded/widest image instance starting from back, and with sort of original colouration/narrowest one being applied to output resource last, and this should implement a form of faded/blurred outline/edging to output image?

However, it again comes down to trying to decide on best/simplest way to apply a form of global transparency filter to an image resource, without needing to specify a specific colour each time for something like the imagecolourtransparent function, since suppose would need to then figure out a way to determine which RGB value would work best per image - and don't think that could be made to work consistently either.

In other words, what am really looking for at moment is a way to set the opacity of an image resource - and if it comes down to capturing the output buffer while using something like imagepng to stream the image resource to the buffer, that's not an issue either since am already using a form of that to sometimes capture image resource data in another way, but, would need to find a way to somehow affect opacity of output stream image then as well.

While I am currently pretty much just using GD library, I would be open to other suggestions/workarounds/thoughts on the simplest way to implement something like this?

And, if I'm just missing, or haven't come across a simple way to implement faded/graded outlines for images, would also like to know that...<smile>

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'



--
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org


--- End Message ---
--- Begin Message ---
hi,

On Thu, Aug 1, 2013 at 6:41 PM, R. S. <rs...@live.com> wrote:
> Hello Anatol,
>
> Wednesday, July 31, 2013, 12:47:58 AM, you wrote:
>
>> As a dessert I'd suggest you to read this ticket from not very recent past
>> about how it's going in python http://bugs.python.org/issue13247 :)
>
> I tried this in python:
>
> filename = "e:\zzzzzzzzz_Ελλάδα.txt"
> a = open(filename, "w")
> a.write("this is a sample line\n")
> a.close()
> print(open(filename,"r").readline())
>
> Works fine. So I even if python has some problems on this line
> they aren't making it unusable for unicode file names.
>
> Even tried to run it with FreePascal with example from here:
> http://wiki.freepascal.org/File_Handling_In_Pascal - where I put shortened 
> path
> since pascal also doesn't heard about unicode, and it works like charm.
>
> Now Perl:
> It also has problem with utf8, it successfully forces file with that encoding
> to be put on disk, resulting in working file with unreadable characters
> or images like arrows etc. (zzzzzzzzz_Ελλάδα.txt)
> but this works:
>
> open MYFILE, ">", "c:\\zzzzzz~2.txt";
> print MYFILE "Test line!\n";
>
>
> So every modern and not so modern language is able to handle somehow, at least
> making it usable to work with unicode filenames.
>
> Any challenge for me ? Give me any language that you think fail here like php 
> ?

PHP does nothing with the paths a script passes to the IO function.
The only operation being done is to resolve relative paths and the
likes but that will only prepend the given path with the current
directory and remove ../.. part of the given paths.

The path is then given as is to the underlying OS file functions,
which work only with ANSI or the current system charset (CP-*). PHP
works perfectly fine with short path, even the ones with ~ in them.
The problem I can see here (but can't confirm as I do not have your
original source code to verify) is that the encoding seems to be UTF-8
and that won't work per se.

Also UTF-8 (or the likes) paths for IO operation has nothing to very
little to do with Unicode support as described or tried in the never
released PHP 6. It is "only" about using another set of the Windows
file APIs, in very short, about using the <funcname>W ones instead of
the <funcname>A (which are aliases to <funcname> when UNICODE define
is not set).

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

--- End Message ---

Reply via email to