Jump to content


Lars282

Member Since 03 Feb 2012
Offline Last Active May 30 2013 08:08 AM
-----

Topics I've Started

How to delete/replace image through API?

16 December 2012 - 01:20 PM

Hey,

How do I delete an image? I just gave $user->user_photo->remove() a go, and accidentally deleted the entire user ...

Basically, I wan to replace the old image with a new one, though $user->user_photo = new simply adds the new one, still keeping the previous ...

Thanks

Lars

Image Upload: Simplest Way?

07 December 2012 - 04:06 PM

Hey,

How do you upload images using the API? I have a feeling my way is not the shortest ...

Since $_FILES['img']['tmp_name'] is without an extension, I aways use
  • move_uploaded_file() to put back the original name incl extension (and unfortunately move the file)
  • $somepage->image->add("new/path/image.jpg")
  • then I have to delete the image from step 1
I am sure there is an easier way?

Thanks,

Lars

Trailing Slashes for URL segments?

07 December 2012 - 10:38 AM

Is there a way of forcing trailing slashes when using URL segments?

Thanks,

Lars

Image Upload broken?

21 November 2012 - 08:20 AM

Hey!

I am not sure since when, but it seems that the image upload on my site is broken. I can no longer upload image through the admin. Everything appears to be fine, but in the end the image has not been added.

I have checked for the images that are already online: it seems they are all missing the file ending, ie they are called .../site/assets/files/1096/phpvwmbuw.

Also, wenn I try to use image->width(500)->url, it results in an error that I am trying to use width on a non object.

I have an image upload form on my website. When uploading through this form, the images are successfully uploaded, but without the file ending. When I then try to access the page for the first time in the admin, it shows this error: phphitkhd.0x100. is an unsupported image type
Subsequent views of the admin page are fine, and it shows all fields and no error.
The 'show thumbnail in admin' box is ticked for the image field.

What is wrong? How can I fix it?

Everything else seems to be working fine.

Thanks for the help,

Lars

//edit: I have already replaced the wire folder with the latest, but this did not fix the issue. I had thought that this should at least fix the issues I have on the admin side, but it didn't.

Dymanic CSS with PHP: How to allow .php file to be delivered?

18 October 2012 - 09:26 AM

Hey,

I want to use PHP in my CSS file. The only way I could make it work is to add my style.php including header("Content-type: text/css") as a template, and then include this page as the stylesheet in my other templates.

While this does offer advantages (style can be easily customised from the PW admin), is there a nicer way of doing this?

Thanks,

Lars