Solved

PHP slice image and output embedded in HTML

Posted on 2015-01-23
14
167 Views
Last Modified: 2015-01-25
I am looking for a way to protect images from download. Figured out the simplest solution would be to slice-up large images into a tile, and if anyone is that persistent to get all those together, than I wish him all the luck :-)

I would need a PHP script that will take source image, split it into a tile of, say, 10x10, and output that in a HTML file as a data stream in a table.

script takes -> [INPUTIMAGE] -> divides it to 10x10 pieces -> returns 10x10 table and fills it with pieces

If there is not anything outright finished, some directions how to write my own script are welcome!


Thanks!
0
Comment
Question by:mrmut
  • 5
  • 5
  • 4
14 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40567002
Why do you think slicing it is going to keep someone from taking it.  All they need to do is use a screen capture and then parse it in any graphics program.

In any case if you really want to do the extra work, just use photoshop to create the slices.

Cd&
0
 

Author Comment

by:mrmut
ID: 40567128
For thousands of images? It can be done, but I think it isn't worth the while. Light discrepancies could create problem later on, so why not just do everything inside php script?
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 40567190
You will find the php to do it here:
http://www.phpclasses.org/package/1804-PHP-Generate-HTML-to-present-images-divided-in-pieces.html

but Icannot understand why anyone would think adding overhead and bloat to a page makes sense to prevent something that is not preventable.  If some one wants the image then what you are doing is not going to make any difference, they will have the image with about 10 seconds effort.

Cd&
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40567243
I agree with Cd& on this, you're wasting your time.  If you put it on the screen, I can get it and you can't stop me.
0
 

Author Comment

by:mrmut
ID: 40567297
Thanks COBOLdinosau, that is the answer.

Re both comments above; if you take big picture in account you are both wrong. First of all, bloat is essentially nonexistent for gzipped HTML with embedded images. Secondly, it is enough of a deterrent. It takes time to get either native or well-croppped webshot. For the webserver load, that is of no importance for rarely run-scripts.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40567381
Are you sure?  This took about 15 seconds.
BigPicture
0
 

Author Comment

by:mrmut
ID: 40568029
Don't you see analog with computer software for which you still have software keys to enter?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40568321
I don't know what you mean.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40568329
@Dave,
Perhaps a case of Dunning–Kruger so there is no point is trying to educate if there is no desire to learn.

Cd&
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40568355
Could be.
0
 

Author Comment

by:mrmut
ID: 40569036
What I wanted to say that software packs have keys to enter, while you can easily both obtain the software and circumvent the trivial key protection where it serves only as a deterrent. What I am doing is the same, where the idea is to create a deterrent sufficient enough that most of the users won't be able to get to the complete 1:1 high resolution image, without some effort or satisfying themselves with browser-downsampled version. This is one of the methods, several of which should be implemented to achieve some filtering. This would dramatically reduce image stealing occurrence, and would make me easier to hunt down those that do. 3-4 vs hundreds.

Apart from that, I haven't yet had the privilege to be insulted on Experts Exchange, so I will take this opportunity to report you two. - You can take your garbage to newsgroups and free forums, but not on paying site for professionals.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40569307
Please do, they know us well.  Somehow, I thought we were the professionals and we don't agree with some of the things you have said.  Like this...
First of all, bloat is essentially nonexistent for gzipped HTML with embedded images.
That is simply wrong.  Images are Not downloaded as part of the HTML,  They are downloaded separately and if you download 100 slices (10x10) instead of one image, that is 99 more file requests than are needed.

I don't know about Cd& but I feel a little insulted that you're not interested in listening to us.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40569526
Before I get insulted I just consider the source and decide if I want to get down to a level where I have to ignore all I have learned by working with Firefox code on MDN an debating whether utter nonsense is worth a response. In this case the nonsense is not worthy of any comment.

However "but not on paying site for professionals" does require a response.  Your payment arrangement is with EE, not me.  I volunteer my time on this site.  If you want someone to confirm that your strange ideas are valid my current billing rate is $160 an hour but if you want I can make one of my staff available to tell you how great your ideas are for about half of that.  

BTW, If you want to complain, the easy way to do it is the "request attention" link at the bottom right of your question.


Cd&
0
 

Author Comment

by:mrmut
ID: 40569659
@Dave Baldwin - You are wrong. There would be only one request, bar css and scripts. Images would be embedded, as specified in original question.

@COBOLdinosaur - I made that comment mainly with EE in mind. Being a payed service, moderation is excellent, which I expect will kick in here. Re your approach, you can exercise it as much as you wish on those who will/have-to tolerate it.

*I will now respond to this thread anymore.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question