Welcome Guest, Not a member yet? Register   Sign In
Preventing direct access to images... or something...?
#13

[eluser]Jim OHalloran[/eluser]
[quote author="crikey" date="1189060510"]I also found a tutorial on the O'Reilly ONLamp site that covers this technique (although the image data is stored in a DB).[/quote]You can store images in the database, and that has some advantages if the images are related to database updates that might take place in a transaction (i.e. you can roll back image updates with the rest of the transaction easily). In general terms though it's more efficient to store the images on the filesystem, there's less overhead involved.[quote author="crikey" date="1189060510"]The only other question I had was if using the controller/method/id URL for the source will still work OK (ie would CI still handle it). But you've answered that too![/quote]The issue isn't actually CI, it just handles the image request the same as any normal page request. The main thing is actually the browser end. You need to make sure you send the appropriate content type header, otherwise the browser won't interpret the data it receives as an image. You also need to ensure that only the image data is ever sent to the browser. Make sure there's no error messages, PHP wranings, etc coming from the script. Otherwise the browser will (quite rightly) treat it as a broken image.

Jim.


Messages In This Thread
Preventing direct access to images... or something...? - by El Forum - 09-04-2007, 09:05 PM
Preventing direct access to images... or something...? - by El Forum - 09-04-2007, 10:31 PM
Preventing direct access to images... or something...? - by El Forum - 09-04-2007, 10:47 PM
Preventing direct access to images... or something...? - by El Forum - 09-04-2007, 10:52 PM
Preventing direct access to images... or something...? - by El Forum - 09-04-2007, 11:38 PM
Preventing direct access to images... or something...? - by El Forum - 09-05-2007, 01:20 AM
Preventing direct access to images... or something...? - by El Forum - 09-05-2007, 01:48 AM
Preventing direct access to images... or something...? - by El Forum - 09-05-2007, 02:02 AM
Preventing direct access to images... or something...? - by El Forum - 09-05-2007, 04:53 AM
Preventing direct access to images... or something...? - by El Forum - 09-05-2007, 05:52 AM
Preventing direct access to images... or something...? - by El Forum - 09-05-2007, 06:11 PM
Preventing direct access to images... or something...? - by El Forum - 09-05-2007, 07:35 PM
Preventing direct access to images... or something...? - by El Forum - 09-05-2007, 08:08 PM
Preventing direct access to images... or something...? - by El Forum - 10-16-2007, 01:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB