Welcome Guest, Not a member yet? Register   Sign In
Render image on the fly vs. saving thumbnails
#11

[eluser]obobo[/eluser]
many thanks missionsix.
I'm going to test this out in the next couple of days.
#12

[eluser]obobo[/eluser]
missionsix ...

even though you're not resizing the image,
isn't there a similar performance hit
when you read the image and then print it through php
rather than just having it accessed directly from the user's browser?
#13

[eluser]missionsix[/eluser]
Yeah there would be some performance hit. But not as significant as generating the thumbnails on every request. (less memory usage, less cpu usage). There might be a better way of doing it, i have not performed any benchmarks on my script yet. But its also possible to pass the file to the browser with readfile(); function, instead of reading the saved image in chunks.

Some advantages of dynamically passing the image is the possibility of a bandwidth/hit counter, or restricting image access to certain domains. I'm not a Perl programmer, so these types of scripts seem easier to implement for me in PHP. But I'm assuming it could also be done with Perl as an apache module when an image is directly accessed, thereby reducing the php performance hit, allowing for faster image access, and also allowing for dynamic processing of image information.


Also if anyone has a better way of doing this, please speak up.
#14

[eluser]Jupiter[/eluser]
missionsix,

how do you make sure that requests will be passed through your media controller, even if they're hotlinked?

Regards,
Peter
#15

[eluser]missionsix[/eluser]
Well since I am supply people with a simple image hosting service, i supply them with the media URL (which passes through the media handler). An example of this would be
Code:
/media/image/032984083/?w=800

Where the media id is a one to one relationship with the image id stored in the database. And then the w=800 lets the script know the final image needs to be 800 pixels wide, so it might it. To me this allows for a lot of flexibility in image manipulation.

So everyone just links to their content with that url structure. The actual image locations are stored on outside of the www folder, which means they cannot be accessed directly.




Theme © iAndrew 2016 - Forum software by © MyBB