Welcome Guest, Not a member yet? Register   Sign In
Does Image Manipulation class work with Blobs?
#1

[eluser]peterbz[/eluser]
Does the image manipulation in CI class work with blobs?

Also, is there more overhead when storing and retrieving images with MySQL blob as opposed to traditional file system storing? In my case, I will have lots of resizing of thumbnails for each of my images. So what is the best way to go about it: file system or blobs?
#2

[eluser]xwero[/eluser]
you always need to work with a temporary file because the manipulation libraries are file based.
#3

[eluser]peterbz[/eluser]
Is there a way to save the output of a blob to a temp file and delete it after my manipulation is finished?
#4

[eluser]xwero[/eluser]
of course just get it out of the data base and put the content in the file. And after you are done unlink it.

But you asked what is better, i would say files because this prevents creating files every time a visitor wants them. Or you could chose to save the thumbnail files as files and the really big files as a blob, that saves you diskspace but i don't know if that is a problem for you.
#5

[eluser]peterbz[/eluser]
Diskspace isn't a problem. I want anything that is the most efficient and least overload so that my users can access the page as fast as possible.

Also, I read somewhere that both can be implemented. Store the image in the database and cache them in the file system when retrieved. Can someone please give me an example of how I would cache it?

Also, would it be practical to store my images in MySQL if it will be retrieved very frequently and in high volume (in a CMS)?
#6

[eluser]xwero[/eluser]
Files are better than a database driven dynamic script because they are static.

For files that are requested frequently you have to create cache files, the blob is only used as a backup.

I would only use a blob if the files are added, are popular for a while and then forgotten.
#7

[eluser]peterbz[/eluser]
How would I go about creating cache from blobs?
#8

[eluser]xwero[/eluser]
The best solution would be to have a controller method that checks if a file exists in the cache directory, if not the blob gets called. The method also can monitor the frequency of the requests for the blob, if it reaches the threshold you set the file will be created.
#9

[eluser]peterbz[/eluser]
How will I set it so that it will delete itself after a certain time (say for example after 24 hours)
#10

[eluser]xwero[/eluser]
you can use a cron to do it




Theme © iAndrew 2016 - Forum software by © MyBB