Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 117,283 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 2,202 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Display random part of an image

 
Reply to this topicStart new topic

Display random part of an image

zingo
post 19 Jul, 2008 - 01:20 PM
Post #1


New D.I.C Head

*
Joined: 19 Jul, 2008
Posts: 3

Hello all,
I need to display a smaller part of a bigger image on a web-page but frankly have no idea of where to start. I've been surfing the web to no avail.

Imagine a bigger picture where I want to display a smaller fixed size part of that picture, kinda like a smaller window randomly placed on the bigger image. Reloading the webpage shall return a different part of the bigger image, such as a dynamic banner.

I recon I need a function to display the picture where I can define e.g. the upper left corner as an offset in the image file. Is there such a function available, preferrable in PHP which I have just begun to explore.

I'm sorry that I have no code to show yet, but as I wrote, I have no idea on where to start...

All ideas and suggestions appreciated.

TIA
/c
User is offlineProfile CardPM

Go to the top of the page


JBrace1990
post 19 Jul, 2008 - 02:23 PM
Post #2


D.I.C Regular

Group Icon
Joined: 9 Mar, 2008
Posts: 456



Thanked 20 times

Dream Kudos: 350
My Contributions


yup, here: http://www.php.net/manual/en/function.imagecopy.php
User is offlineProfile CardPM

Go to the top of the page

zingo
post 21 Jul, 2008 - 01:38 AM
Post #3


New D.I.C Head

*
Joined: 19 Jul, 2008
Posts: 3

QUOTE(JBrace1990 @ 19 Jul, 2008 - 02:23 PM) *


Ouch... Thanx much!
I'll immediately run off to RTFM biggrin.gif
I've been googling and reading but seems to have missed the important part... blush.gif
User is offlineProfile CardPM

Go to the top of the page

zingo
post 22 Jul, 2008 - 02:01 AM
Post #4


New D.I.C Head

*
Joined: 19 Jul, 2008
Posts: 3

QUOTE(JBrace1990 @ 19 Jul, 2008 - 02:23 PM) *


Btw, before I run off to try this, I have another question that you may be able to answer as well?

Until now, I have only used PHP to generate dynamic pages to work with database information, all images etc has been static. And the load on the web-server has not been too high to make me think too deep about sharing resources.

If I use PHP Imagecopy to generate a dynamic banner as described above and two users accesses the webpage concurrently, will the generation of the temporary image for the banner clash or do they have separate data processing areas with their own temporary image inside the web-server? I.e. when the script is running, creating the small random image from the bigger for both of the users, will they see different images or the same? They both run the same PHP code to generate the small, temporary, image from the bigger, static, one but where is the result stored? And is there a risk for malfunction if the temp image is rebuilt by one user at the same time as it is displayed for another user?

I recon the userspace is separate and that the temp image is kept therein but I haven't really thought about it before.

Rgds
/c
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/6/08 10:49PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month