gottaloveit 44 Newbie Poster

This is just an initial observation / question, but why are you running every step through rawurlencode? Look at the definition of the function - every time you run it on a string it will encode everything non numeric except -_.~ ... so if you run it once and it returns %20 for example and you run it again on that string, that %20 will become like %blah%20 or whatever. If it were me, I would not have any rawurlencode in your sign function. Build your query string in plain ole English, like you are typing into the browser, then right before you send it you encode it. Or better yet use curl_escape.

FarrisFahad commented: Yay +12
gottaloveit 44 Newbie Poster

In whatever code language is running on the server, use a well known database library that is well documented and features XSS aka sql injection prevention.

gottaloveit 44 Newbie Poster

I agree with everyone else, you can never prevent downloading, since the browser has to download, but you can make it harder for people to save and re-use the images. Here's a PHP script using standard PHP GD library, nothing special. It will break the image down into small chunks and then generate HTML to load them in the browser. So viewing source or inspecting the "image" will show up as a huge amount of really small images with totally random names. So reassembly would be tricky unless they did a lot of work copying the original HTML source to reassemble them.

Please don't flame me on the code. I know it can be improved for performance and other reasons, this is just an example of a possible solution, and it does work.

<?php

# the below width and height are set static and work out with no extra width or height
# from the source image.
# in production, it would probably be better to dynamically create the height and width 
# using a method to make sure there is no space left over
# or track the space left over in the loop and adjust the specs
# this is just for an example of the requirements of the OP

$width = 30; 
$height = 30; 
$sourceFile = "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg";
$source = @imagecreatefromjpeg( $sourceFile ); 
$source_width = imagesx( $source ); 
$source_height = imagesy( $source ); 
$randomStringLength = 32;

$numberOfPixels = (($source_height * $source_width) / ($width * $height));
if ($numberOfPixels …
Dani commented: Creative solution! +34
gottaloveit 44 Newbie Poster

From watching the video, I am understanding your question to be

Why does the application load so slowly in the browser?

So, judging from the task manager, I am going to assume you are using a laptop (since it has a dual core processor with 8gb of ram) and that you are running PHP's built in web server (since it is accessing port 8000 on localhost) and you are running MySQL locally. Not looking at your code at all, I would expect some delays in this environment as a laptop, PHP web server are not production suited environments. Have your tried the code and the database on an actual server?

Also, just in case, make sure you are properly indexing your MySQL tables.