I'm doing this to get the image name and directory to pass to PImage

Where Picture is my model for storing the image information, and path
is where the image is stored, relative to the img/ dir. (e.g. 'uploads/
pictures/myimage.jpg')

$path_info=pathinfo($this->data['Picture']['path']);
$image_dir=WWW_ROOT . 'img' . DS .$path_info['dirname'] . DS;
$image_name=$path_info['basename'];

Think that should help you.

On May 19, 12:23 am, MeatSandwich <[email protected]>
wrote:
> I'm using the 
> advicewww.jamesfairhurst.co.uk/posts/view/uploading_files_and_images_with_c...
> to handle uploading images.
>
> The function uploads the files to the appropriate folder and then
> returns a url which I add to $this->data so the location of the image
> is saved in the database
> To call the function:
> $fileOK = $this->uploadFiles('img/files/campaigns', $this-
>
> >data['File']);
>
> Then add the url to the array to be saved
> $this->data['User']['image_url'] = $fileOK['urls'][0];
>
> image_url would end up looking like: files/campaigns/userphoto.jpg
>
> After I've done this, I want to resize the image a couple of times so
> I have a large thumbnail and a smaller one as well as the original.
> I'm using the advice at bakery.cakephp.org/articles/Perkster/
> 2008/04/12/image-resizer-crop
>
> to call the function I have to do
> $this->PImage->resizeImage('resize', 'myimage.jpg', WWW_ROOT . 'img' .
> DS, false, false, 480)
>
> in the above the myimage.jpg bit I'd obviously want to replace with
> userphoto.jpg and the WWW_ROOT . 'img' . DS bit (which is supposed to
> be the folder where the image is) I'd want to presumably put files/
> campaigns.
>
> My question simply is, how can I get from :
> $this->data['User']['image_url']
>
> To having two vars, one with just the userphoto.jpg and the other with
> just the folder the image is in?
>
> I hope that makes sense, I'm new. I did try changing the PImage
> function so it only needed the value in $this->data['User']
> ['image_url'] but that just caused lots of errors unsurprisingly.
>
> thanks in advance

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to