[Phpwm] displaying images on screen

Simon Ferre simon.ferre at onetwodo.co.uk
Thu Oct 2 16:30:45 UTC 2008


Alan

What you need to do is have the code which rotates the image in its own php
file, and on the page which displays the image, have it as a image tag
within the html, like this:

<img src="/path/to/code/displayrotated.php?filename=blah&rotation=90">

What you will then do, in your separate displayrotated.php code is parse the
parameters, load the image, rotate it and output it as you were going to do.

Hopefully, being within the <img> tag should make sure the image is returned
and parsed correctly.

Simon Ferre

-----Original Message-----
From: phpwm-bounces at mailman.lug.org.uk
[mailto:phpwm-bounces at mailman.lug.org.uk]On Behalf Of alan dunn
Sent: 02 October 2008 15:29
To: West Midlands PHP User Group
Subject: Re: [Phpwm] displaying images on screen


Thanks so far - I didn't get all the question correct! We agree about
how to put the image to the page. The problem (I now understand) is that
we want to show it as a pop-up within an existing page, so the header
line is already set: content="text/html; "

What this does is cause the image to display as text.

thanks again, alan

BinaryKitten wrote:
> alan dunn wrote:
>
>> This probably has an easy answer, but we haven't found it.
>>
>> We have an archive of jpeg images. We want to open one using GD library
>>
>> $im1 = imagecreatefrom jpeg($pathname.$filename);
>>
>>  rotate it:
>>
>> $im1 = imagerotate($im1,-90,0);           .... and display it on screen.
>>
>> How do we get to display the image which is now represented by resource
>> $im1?
>> We know you can do it by saving the rotated image back to somewhere then
>> displaying the saved image - but that's a lot of overhead just to show a
>> temporarily rotated image.
>>
>> Any help much appreciated, thanks, Alan Dunn
>>
>>
>>
>>
> as you've created a jpeg resource, you will need to output the header
> that you are ouputing a jpeg instead of the standard html.. to do this
> use the following snippet:
>
> header("Content-type: image/jpeg");
>
> then call upon the imagejpeg function passing $im1 to it like so:
> imagejpeg($im1);
>
> you can also save to a file if you want, again using hte imagejpeg
function
> imagejpeg($im1, "/path/filename.jpg")
>
> as well as choose the quality level you want to ouput
> imagejpeg($im1, null,(0-100))  // Output to screen @ quality level
> imagejpeg($im1, "/path/filename.jpg", (0-100))
> // Output to file @ quality level
>
> the default quality level is 75.
>
> Finally don't forget to call imagedestroy($im1) afterwards to clean up
> the memory...
>
> Kat
>
>
> _______________________________________________
> Phpwm mailing list
> Phpwm at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/phpwm
>
>
>

--

DISCLAIMER:

This document originates from within Dunns Imaging Group Limited.
This message, together with any associated files, is intended only for
the use of the individual or entity to which it is addressed and may
contain information that is confidential, subject to copyright or
constitutes a trade secret. If you are not the intended recipient of
this communication you are hereby notified that any dissemination,
copying or distribution of this message, or of any files associated with
this message, is strictly prohibited.
If you have received this message in error, please notify us at once.

Dunns Imaging Group Ltd.
Registered Office: Chester Road Cradley Heath West Midlands B64 6AA.
Tel: 01384 564770
Registered in England 598527.


_______________________________________________
Phpwm mailing list
Phpwm at mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/phpwm





More information about the Phpwm mailing list