php-windows Digest 7 Aug 2013 07:48:24 -0000 Issue 4128
Topics (messages 31095 through 31096):
Re: Readfile() + mpg = http status 500, windows server 2012, php 5.5.1
31095 by: oli.laurel.arcor.de
Cropping images with fading outline effects, using GD, etc.?
31096 by: Jacob Kruger
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 Jacob,
with your php script all requests are 200.
header('Content-Disposition: inline; filename="movie.mpg"');
header('Content-Disposition: attachment; filename="movie.mpg"');
Thx + Regards
Oli
----- Original Nachricht ----
Von: Jacob Kruger <ja...@blindza.co.za>
An: php-wind...@lists.php.net
Datum: 03.08.2013 00:11
Betreff: Re: Re: [PHP-WIN] Readfile() + mpg = http status 500, windows server
2012, php 5.5.1
> And, what if you try reading the file's contents into a variable, and then
> echo that to the output buffer:
>
> <?php
> $track = "movie.mpg";
> header("Content-Type: audio/mpeg");
> header('Content-Length: ' . filesize($track));
> header('Content-Disposition: inline; filename="movie.mpg"');
> //could also, again, try attachment here
>
> $file = fopen($track, "rb"); // end b character implements binary mode
> $data = fread($file);
> fclose($file);
> echo $data;
> exit;
> ?>
>
> Just asking since that might give you more detail about what's causing the
> error to happen, depending on whether the fopen. fread, etc. then trigger an
>
> error, and, haven't bothered double checking actual file name, etc. - just
> used a form of example name - and, also didn't double check code above -
> sorry...<smile>
>
> Also, you should make sure there's no HTML markup being echoed/output before
>
> this code executes, since think it might interfere with then 'clean' output
>
> of file contents.
>
> Stay well
>
> Jacob Kruger
> Blind Biker
> Skype: BlindZA
> '...fate had broken his body, but not his spirit...'
>
> ----- Original Message -----
> From: <oli.lau...@arcor.de>
> To: <ja...@blindza.co.za>; <php-wind...@lists.php.net>
> Sent: Friday, August 02, 2013 8:48 PM
> Subject: Aw: Re: [PHP-WIN] Readfile() + mpg = http status 500, windows
> server 2012, php 5.5.1
>
>
> > Sorry i forgot to answer your question:
> > no difference between
> >
> > header('Content-Disposition: attachment; filename="movie.mpg"');
> > and
> > header('Content-Disposition: inline; filename="movie.mpg"');
> >
> > thx + regards
> > oli
> >
> >
> > ----- Original Nachricht ----
> > Von: Jacob Kruger <ja...@blindza.co.za>
> > An: php-wind...@lists.php.net
> > Datum: 02.08.2013 20:04
> > Betreff: Re: [PHP-WIN] Readfile() + mpg = http status 500, windows server
>
> > 2012, php 5.5.1
> >
> >> And, if you change Content-Disposition to something like?:
> >> header('Content-Disposition: attachment; filename="movie.mpg"');
> >>
> >> Jacob Kruger
> >> Blind Biker
> >> Skype: BlindZA
> >> '...fate had broken his body, but not his spirit...'
> >>
> >> ----- Original Message -----
> >> From: <oli.lau...@arcor.de>
> >> To: <php-wind...@lists.php.net>
> >> Sent: Friday, August 02, 2013 6:20 PM
> >> Subject: [PHP-WIN] Readfile() + mpg = http status 500, windows server
> >> 2012,
> >>
> >> php 5.5.1
> >>
> >>
> >> > Hi List,
> >> > i installed a blank Windows Server 2012 Standard, added Role IIS &
> >> > Feature
> >>
> >> > CGI
> >> > extracted 5.5.1 VC11 x86 Non Thread Safe to c:\Program Files (x86)\php
> >> > installed vcredist_x86.exe
> >> >
> >> > added Handler Mappings in IIS
> >> > Request path: *.php
> >> > Module: FastCgiModule
> >> > Executable: c:\Program Files (x86)\php\php-cgi.exe
> >> > Name: PHP via FastCgi
> >> >
> >> > Added 2 files to C:\inetpub\wwwroot index.php & movie.mpg (6MB)
> >> > Content of index.php
> >> >
> >> > <?php
> >> > $track = "movie.mpg";
> >> > if (file_exists($track)) {
> >> > header("Content-Type: audio/mpeg");
> >> > header('Content-Length: ' . filesize($track));
> >> > header('Content-Disposition: inline; filename="movie.mpg"');
> >> > header('X-Pad: avoid browser bug');
> >> > header('Cache-Control: no-cache');
> >> > readfile($track);
> >> > exit;
> >> > } else {
> >> > header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
> >> > echo "no file";
> >> > }
> >> >
> >> > ?>
> >> >
> >> > Now every time the index.php is requested i get an error 500 in
> >> > Webserver
> >>
> >> > log. But file will be delivered sucessfully.
> >> > Is there a problem with mpg files and readfile();
> >> > No difference with 5.4.17, 5.3.27 & Windows Server 2008 R2.
> >> > I know its very basic, but expected result should be: HTTP-Status: 200
> >> or?
> >> > phpinfo() will be delivered succesful.
> >> >
> >> > Thx + regards
> >> > oli
> >> >
> >> > --
> >> > PHP Windows Mailing List (http://www.php.net/)
> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >
> >> >
> >>
> >>
> >> --
> >> PHP Windows Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
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 ---