I'm coding a small news component for a website using cakephp. The ideal way in which this would work is by letting the administrator input the title for the news item, the source, the link to it (if available), its contents (to have a back up) and an accompanying image for it.
It all works but the image part. Since every entry is meant to have at most ONE image, I'm storing the image info in the same database table I'm storing the posts. I have so far managed to upload the image file to app/uploads/ and add its data (name, size and type) to the database.
Now I can't show it.
All I have managed to do looking around is set the image to be the single content of a page by using:
$this->response->file($url);
However, I need to be able to show this image as an embedded part of a website, just as most images in the web are shown. I've been looking around and can't seem to find any proper guides on doing this. The simplest solution (Linking to the image by knowing the path to the images folder) also won't work since they are in app/uploads, meaning that if I link there cakephp thinks I'm calling an 'uploads' class that doesn't exist. Using MOD_REWRITE could be an option but, in all honesty, it seems to me it would be more of a hack since there has to be a way to take a stored file and dump it as an image so that it can be embedded on the very site that's storing it.
Does anyone know about this?