andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


help

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator
View previous topic :: View next topic  
Author Message
hunter
Newbie


Joined: 11 Jul 2005
Posts: 3

PostPosted: Mon Jul 11, 2005 12:14 pm    Post subject: help Reply with quote

Hello and thanks for the help. I like what i see and wished i had php knowledge but am just starting out and learning. is there somewhere i can find how to use this script with complete list of instructions. i downloaded the files and then put them in a folder with about 5 images and set the permissions on all the files to 755 on the server and i dont see any thumbnail or anything done. What exactly do i need to do to get it to work. i am sorry for my ignorance i just dont understand. What i want it to do is to take some pictures and crop the to a square size as thumbs. thank you for your help.
Back to top
View user's profile Send private message
hunter
Newbie


Joined: 11 Jul 2005
Posts: 3

PostPosted: Tue Jul 12, 2005 1:31 pm    Post subject: Reply with quote

Wow did I say something wrong or just to dumb??? If I make a donation would that help to get what I need?? Let me know and thanks for any help.
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Tue Jul 12, 2005 4:35 pm    Post subject: Reply with quote

Hi hunter, welcome to the board!

hunter wrote:
Wow did I say something wrong or just to dumb???


No to both of them. You only posted up here yesterday, and I intended to answer your PM when I saw it but just didn't get a chance. This week has so far been pretty hectic for me - Saturday I didn't finish working on projects for the day until around 3am, Sunday it was 1am. Monday I worked from 8am - 11:40pm and today I've just finished an 8am - 10pm stint. I am but one man, and try to get around to answering posts as and when I can! Sometimes I can answer them sooner rather than later, and the simply things I'll try to answer right away if it doesn't get in the way of my regular jobs (gotta pay the bills some how! Wink )

Okay, with that said; let's try to help you out with your query! Smile

What you're trying to do might actually be two different things.... If the pictures are big and you want to resize them down to make thumbnails, and then make them square in dimension by cropping off some of the canvas, then you'll need to use the crop canvas class and the dropshadow class. These threads may help out in doing that:

http://php.amnuts.com/forums/viewtopic.php?t=120
http://php.amnuts.com/forums/viewtopic.php?t=66
http://php.amnuts.com/forums/viewtopic.php?t=196

But for now we'll just take your immediate concern; getting the resize script to work.

The files you should have downloaded are as follows:

class.dropshadow.php
test.dropshadow.php
ds_blcorner.png
ds_bottom.png
ds_brcorner.png
ds_left.png
ds_right.png
ds_tlcorner.png
ds_top.png
ds_trcorner.png

The png files are not required if you have no desire to use the faux drop-shadow. The class can be used as a general image resizer without ever having to apply drop shadows. But we'll assume that you are going to use that at some point.

Create a folder in your web root folder where the files will be. For this example we'll call it 'example'. In the example folder create another folder called 'shadows'. Place all the png files in there and the php files in the examples folder.

In the examples folder, create another folder called 'images'. In there place a jpg file and call it 'test.jpg'.

Make sure all of the files and folders have read permission to the web server. You sound like you know how to do that already.

Now in your browser, load up test.dropshadow.php and see if you get a result. If not then you'll want to see if there is any feedback the class can give you to see if something went wrong. To do this, turn on debugging which is done by passing 'true' (boolean, not string) when you instantiate the class. Open up test.dropshadow.php and change this line:

$ds = new dropShadow(FALSE);

to this

$ds = new dropShadow(true);

Now run the script again. It should give you some feedback such as if it cannot find the file, read it, etc.

Obviously it'll be a lot easier to guess what's wrong if you post up the information when things go wrong and you're stuck. But try out the above first and let me know how you get on.

Once you get it to work, then you can look into resizing all images in a folder automatically, or selecting an image from a folder, etc.

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
hunter
Newbie


Joined: 11 Jul 2005
Posts: 3

PostPosted: Wed Jul 13, 2005 9:45 am    Post subject: thank you Reply with quote

thanks for the help and I reallly do understand the workload you have and didnt mean that to sound like that. thanks also for helping me when i have no php experience at all i am sure its frustrating to deal with novices and do appreciate it. I followed your instructions and here is what i get on the return. man it looks like everyone just uploads this stuff and it works for them i must really not have a clue here lol thanks again. there was a ton more of the grabled stuff but i think yu get the jist of what i got.

Debug message from function resizeByPercent: Image size is 264.5 / 396

Debug message from function applyShadow: Original image size = 264/396 : Drop shadowed image size = 280/412


Warning: Cannot modify header information - headers already sent
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Wed Jul 13, 2005 10:58 am    Post subject: Re: thank you Reply with quote

hunter wrote:
thanks also for helping me when i have no php experience at all i am sure its frustrating to deal with novices and do appreciate it.


Not frustrating at all to deal with and help newbies! We all hard to start out there once upon a time. I still consider myself a newbie when I compare myself to other really seasoned PHPers out there. Smile

hunter wrote:

Debug message from function resizeByPercent: Image size is 264.5 / 396

Debug message from function applyShadow: Original image size = 264/396 : Drop shadowed image size = 280/412

Warning: Cannot modify header information - headers already sent


Perfect, the script works! But we need to do a little tidying up before you can see the results you're expecting...

HTTP headers is a concept that you should get familiar with if you're not already. What PHP does (by default, unless you tell it to otherwise), is send a text/html header when it outputs anything. You can control this by using the header() function in PHP. When PHP echos text to the screen, as it is doing with the debugging messages, it will automatically send the text/html header. Now when you go to display the image in suce a raw format it's actually going "okay, when content type am I? Well, I see the text/html header has already been sent, so I must be text!" and then proceeds to display as such. When actually the image is a PNG file and binary, so you just see garbled characters.

If that doesn't make sense, let me know and I'll try to explain further. How check out the PHP manual entry for the header function:

http://uk2.php.net/header

So there are possibly two things you need to do. Turn off debugging. Instead of passing 'true' to the class, pass 'false' or don't pass anything at all (debug defaults to off). Debugging should be used if something doesn't work and you want a little hint as to why. Now run the script again and you should see the image. If not, try putting this line just before you use the showFinal/showShadow method (whichever you are calling):

header('Content-type: image/png');

But I think the class pre-sets this header anyway.

What you have to make sure of, and this is something a lot of newbies fall down at, is that the class.dropshadow.php file - or any other file you include before you change the content-type header - must not have any white space outside of the PHP tags. This includes tabs and newlines. That white space is the same as sending actual text to the browser and will set the content-type to text/html.

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
motionbliss
Newbie


Joined: 11 Jul 2005
Posts: 21

PostPosted: Thu Jul 14, 2005 9:29 pm    Post subject: Reply with quote

Hi Andy!

I'm getting the same "Cannot modify header information - headers already sent by..." error (followed by a couple pages of ASCII which I presume is my image).

Yeah, it's the end of a long work day -- and I'm not grasping something. Care to enlighten another weary soul (like yourself)?

Thanks!

//craig
Phoenix, AZ


Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Shadow Test</title>
</head>
<body>
<?php

   require "class.dropshadow.php";

   $ds = new dropShadow(FALSE);
   $ds->setShadowPath('./shadows/');
   $ds->loadImage('./passport.jpg');
   $ds->resizeByPercent(0, 0);
   $ds->applyShadow('CCCCCC');
   $ds->showShadow('png');
   
?>
</body>
</html>
Back to top
View user's profile Send private message Visit poster's website
motionbliss
Newbie


Joined: 11 Jul 2005
Posts: 21

PostPosted: Thu Jul 14, 2005 11:18 pm    Post subject: Reply with quote

motionbliss wrote:

Yeah, it's the end of a long work day -- and I'm not grasping something. Care to enlighten another weary soul (like yourself)?


OK yeah, I'm an ass... lol -- I tried to put the script inside of a an actual PHP/HTML page. oops.

Embarassed
Back to top
View user's profile Send private message Visit poster's website
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Fri Jul 15, 2005 2:35 am    Post subject: Reply with quote

Like you said; end of a long day... Anything can be forgiven at that point! Smile

But the good news is; it's Friday! Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Drop Shadowed Thumbnail Creator All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group