Question

We have a set of images, around 2500, that are stored in a local RHEL 6.2 server. We also have a MySQL DB with all the names of these files.

The problem is, when we call html2pdf to create the PDF from an HTML generated through PHP, whenever it loads an image with special chars, such as áéíóúÁÉÍÓÚñÑ, the script throws an error because the file can't be read (because of the special chars, not because of permissions).

so the question is:

MySQL returns natively the filename as "imágen 1 00023884 otoño.jpg", and the files are stored in RHEL with the same name.

How do you tell getimagesize() that it should read the filename AS IS ?

I've tried fopen but it doesn't work either, even if I rawurlencode the filename it throws the can't load file error. ("allow_url_fopen" is on)

Everything else works fine with files with no special chars.

Hope I made myself clear.

Thanks!

Was it helpful?

Solution

I would try GetImageSize(realpath($path)). Other than that, can you open the image with ImageCreateFromString(file_get_contents($path))? If so, you'll be able to call ImageS[XY].

Another option would be to rename the files to a slug and update your database accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top