在Cakephp 2.3中显示图像

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?

For things that need to have public access for visualization, like css or js files... or in this case images, the easy option is to put it in the webroot folder.

The usual structure I have with cake is like

/app
   /Config
   ....
   /webroot
      /js
      /cs
      /users
         /images
         /docs
         ...etc

Trying to access a folder in app (like app/uploads) will cause problems with the routing of controllers and views. So it's easier to keep things inside webroot. Specially if it's images strictly related with cake only.

Keep in mind that things in webroot have public access, so don't keep files in there that you don't want to be accessed by url.