How can optimize images created in real time? [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How can optimize images created in real time? I have a php file that creates chess diagrams with FEN in real time. I use ~12 of those chess diagrams on my main web page at http://communitychessclub.com/index.php
Is there a way I could pipe or tee the img url?

It seems that these image don't change on every request, so you should definitely cache them.
Make hash (sha1, md5) string from attributes for file name and save them as jpegs. On every page request check if file exist, if not, generate, cache and return it. It will be way faster.
To optimize more you could use ajax. Return page with placeholders for images, then load each image with ajax and replace placeholders.

Related

Show images and play videos without allowing copying, or downloading [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Is there any way to display images and / or videos on a website and not allow visitors to download or copy them?
I once saw a website where I tried to download an image, but then it was impossible to open it on my computer because the file type was not recognized on my computer!
Is there any way to encode the files, maybe?
Thank you all.
If you can show the images and videos in a browser, they will always find a way to copy these. You can't have the cake and eat it.
The only thing you can do is to make it harder for the newbie.

How to post a picture from iPhone app (in Swift) to MySQL database? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am trying to have users upload on imagine on the app I am developing for a class with Swift and posting it to my MySQL database with PHP but have no idea how to do this. I cannot find any sort of source code online for this and am at a loss for trying this myself.
Does anybody know how to do this?
Though you can technically store images in a MySQL database, it's really bad practice.
Instead, you'll want to store the file in a disk directory. Since this is a broad question with an almost limitless amount of ways you could achieve your goal, here's one suggestion:
Send the file as POST data to your server.
Store the file using PHP.

How can I best generate/load a thumbnail [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm building a iPhone Application which displays some photos. First in a UICollectionView as a thumbnail then bigger in fullscreen.
For better loading behavior I would like to load smaller images first for the thumbnail part. Now: Should I do this via PHP and resize the existing big image or should I save a second image on the server XXX_thumbnail.png and load this one?
Thanks for your tip.
Chris
Resizing an image can be quite an intensive process for the server, especially with larger images. Imagine if 1000 users hit it at the same time. You absolutely should only do this once per image, and save it for later requests. Whether you pre-render all thumbnails or not is another matter, but executing a file_exists is pretty cheap. You can just render them once, at the time they are requested. All depends how you want to access them (e.g. through a script or just the thumbnail url directly)

Is there special reason why online services often store images with semi random name [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
In real practice we see user uploaded image with name like 84b222882da311e284b222000a1fbcf6_7.jpg
Isn't it much easier and structured to just store image as
/username/101.jpg
/username/102.jpg
(For example you can have a database table for images and you can then simply use the index as file name.)
What are the practical consideration here? I guess one would have to check every time whether a newly generated random name is not in the database? Is there concern about obfuscation?
Typically it's done for two reasons.
To have unique filenames.
Makes it difficult to guess image filenames (stops people from just entering the next image in the URL and seeing the image).
Isn't it much easier and structured to just store image as /username/101.jpg /username/102.jpg
Not at all. That way requires a directory listing to get the highest number used, and presents issues with deletions - do you reuse the ID? 101.jpg and 102.jpg are at least as arbitrary as 84b222882da311e284b222000a1fbcf6.jpg, which is likely a hash of the file content or the file's ID in the database.

PHP website file transfer [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to build a website with PHP where my users can host their music files on my server. When my users log into my site, they are presented with a file directory of all their songs, and can drag and drop to add new ones to their collection, delete old ones hosted on my server, rename them, stream music, download it, etc, etc.
My question is this: what is the best way to facilitate this file transfer/showing directories/all stuff mentioned above? FTP? HTTP requests? Speed is key for me. Suggestions?
(And if you might be able to point me to a framework to start with in your response that would be really cool too)
javascript, jQuery, php's opendir();, php's readdir(); with combination of ajax
for streaming, flash player

Categories