Image Tanscoder and storage.php

Hi, I setup a server for just friends and family, everything is working all permissions are fine apache 2.4 is fine and PHP 8 is fine. all audits are fine, fairly new installation, using UNA 13 RC1, server audit all "ok" Cron Jobs working, file and folder permissions are fine as well, I know it's an RC1 release, all modules auto updates on their own just yesterday, oembed\emeding works youtube etc.. only anything uploaded images and videos do not display

Dec 29 16:50:17 [5] /image_transcoder.php?o=bx_persons_thumb&h=10&dpx=1&t=1672332553 [bx_persons_thumb] ERROR: storeFileLocally_Storage failed, getting file from URL ../storage.php?o=bx_persons_pictures&f=wyvyr2vgvaybhjlblctkjaki9zjzyvgr.jpg) failed

When I look at the file on the server I see this wyvyr2vgvaybhjlblctkjaki9zjzyvgr instead of wyvyr2vgvaybhjlblctkjaki9zjzyvgr.jpg

It's not urgent I am just testing to see how UNA works and may use it once I see how everything works, so I can rebuild UNA site anytime as I have direct access to the server (Linux)

And to be honest I really don't need any transcoding for images or videos, as this is a very small deployment, but in the near future may go big

Any suggestions, again not important take your time

Regards,

Rawdata

  • 1271
  • More
Replies (18)
    • To transcode an image or video UNA needs to fetch the original file, UNA tries to get it via URL from the server itself, however if your site can't be loaded from the server itself then it fails.

      It maybe different way to fix this, but in most cases it helps if you add the following line to /etc/hosts file:

      127.0.0.1 your-una.domain
      
      • Hi Alex T

        That's the only thing I have not tried, I will give that ago and report back

        Thank You

        • Sorry for the late reply  , your suggestion below worked out perfectly, can post images and videos without issue, however I had to disable MP4 transcoding for all my videos to post correctly without error, it might be my FFMPEG version and or the CPU I am using, only set this deployment up for testing when I upgrade to a better server I will spend more time on the transcoding bit, thank you for your time
          To transcode an image or video UNA needs to fetch the original file, UNA tries to get it via URL from the server itself, however if your site can't be loaded from the server itself then it fails.
          It maybe different way to fix this, but in most cases it helps if you add the following line to /etc/hosts file:
          127.0.0.1 your-una.domain
          
          • Hello, in which folder is this file located?

            • @dreamlove in particular which file are you referring to? we talked about host file and trancoding files?

              • du fichier hosts 

                • For Linux /etc/hosts <== this is the file for Windows based system usually C:\Windows\System32\drivers\etc\hosts <== this is the file

                  • Hello, i can't upload images here is my hosts...is it ok for you?

                    image_transcoder.php?o=sys_images_editor&h=1245&dpx=2&t=1682959894

                    • If you define a server on which the application runs with the domain name in server settings, how will you scale the application on several servers? I think that the domain name must be defined in the reverse proxy level or in the web server or load balancer server, I don't understand how you think it is possible to build a social network on a single server. 😀

                      In the context of scaling an application across multiple servers, defining the domain name at the reverse proxy level or within the web server or load balancer configuration is crucial. This setup allows for efficient distribution of traffic across multiple servers, enabling the application to handle increased load effectively. Without such configuration, attempting to run a social network or any sizable application on a single server would be impractical due to limitations in resources availability and capacity.

                      Any modern app must be designed for scalability,

                      If an application lacks scalability, the time and resources poured into it may go to waste. It's impractical to build a business model around an application that can't grow. However, if the aim is purely recreational, experimenting with such an app can enhance the user experience, but its utility remains confined to that realm. In a business context, for an application to launch online, it must boast scalability and high availability, capable of withstanding hardware failures. Moreover, for financial efficiency, it should self-scale both vertically and horizontally. Otherwise, it risks draining resources without yielding results.

                      And when we're talking about building a social network with millions of users, that means you're headed for bankruptcy from the very beginning.

                      • It's possible to have the same domain and several web instances, it depends on configuration, also you can make UNA to work on any domain as well if you need, to do this just change:

                        define('BX_DOL_URL_ROOT', 'https://example.com/');
                        

                        to:

                        define('BX_DOL_URL_ROOT', ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') ? 'https' : 'http') . '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'https://example.com/') . '/');
                        
                        • At the moment, none of the instances are functioning correctly. I attempted to use UNA version 14.0.0-B1 with Docker from GitHub. While the site installs successfully, image transcoding is non-functional, and the cron job within the container fails to start. The hostname is set to localhost:888 and folder permissions are set to 777. It likely requires specific configurations, but I couldn't find any useful information on https://unacms.com/wiki/Installation. I initiated the installation using docker-compose up, which installed the site along with the databases and all containers. Although I can create profiles and users, any uploaded images for profiles cannot be processed.

                          • Why don't you write these things in the documentation? You work for boonex?, yur documentation is almost non-existent although this script dolphin or una or una-cms, no one knows what this script name is called because your team always change the name.

                            • I think you mean changing this variable in the file /inc/header.inc.php

                              define('BX_DOL_URL_ROOT', 'https://example.com/');
                              

                              to:

                              define('BX_DOL_URL_ROOT', ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') ? 'https' : 'http') . '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'https://example.com/') . '/');
                              

                              after the instalation when this file is created, it would be the only place where it makes sense. I will try this too.

                              • Docker-compose is for development purposes, we use internally, for production use it needs some adoption specific to your use case, we have another official docker image here - https://hub.docker.com/r/unaio/una

                                • Thank you, I solved this, the problem is that the prefix does not work in nginx in my website https://unacms.com/d/fresh-install-docker-14-0-0-b1 I would appreciate it if you could help me, I use nginx as proxy and caddy as reverse proxy

                                  • if i change the file inc/header.inch.php

                                    this variable:

                                    define('BX_DOL_URL_ROOT', 'https://example.com/');
                                    

                                    with this variable

                                    define('BX_DOL_URL_ROOT', ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') ? 'https' : 'http') . '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'https://example.com/') . '/');
                                    
                                    

                                    i will get this invalid link in logs and the video transcoding Failed:

                                    May 26 14:07:01 [0] CRON [bx_videos_video_poster_preview] ERROR: storeFileLocally_Storage failed, getting file from URL(http://https://www.exemple.com//s/bx_videos_videos/cyhipts9iduxcqyszqj3ehyt924rzqnt.mp4) failed
                                    May 26 14:07:01 [0] CRON [bx_videos_video_mp4] ERROR: storeFileLocally_Storage failed, getting file from URL(http://https://www.exemple.com//s/bx_videos_videos/cyhipts9iduxcqyszqj3ehyt924rzqnt.mp4) failed
                                    May 26 14:07:01 [0] CRON [bx_videos_video_poster_cover] ERROR: storeFileLocally_Storage failed, getting file from URL(http://https://www.exemple.com//s/bx_videos_videos/cyhipts9iduxcqyszqj3ehyt924rzqnt.mp4) failed
                                    May 26 14:07:01 [0] CRON [bx_videos_video_poster_gallery] ERROR: storeFileLocally_Storage failed, getting file from URL(http://https://www.exemple.com//s/bx_videos_videos/cyhipts9iduxcqyszqj3ehyt924rzqnt.mp4) failed
                                    May 26 14:14:02 [0] CRON [bx_videos_video_poster_preview] ERROR: storeFileLocally_Storage failed, getting file from URL(http://https://www.exemple.com//s/bx_videos_videos/hyfhstxd65w7wq4jbjegmbzdpmlzdvmb.mp4) failed
                                    May 26 14:14:02 [0] CRON [bx_videos_video_poster_gallery] ERROR: storeFileLocally_Storage failed, getting file from URL(http://https://www.exemple.com//s/bx_videos_videos/hyfhstxd65w7wq4jbjegmbzdpmlzdvmb.mp4) failed
                                    May 26 14:14:02 [0] CRON [bx_videos_video_mp4] ERROR: storeFileLocally_Storage failed, getting file from URL(http://https://www.exemple.com//s/bx_videos_videos/hyfhstxd65w7wq4jbjegmbzdpmlzdvmb.mp4) failed
                                    May 26 14:14:02 [0] CRON [bx_videos_video_poster_cover] ERROR: storeFileLocally_Storage failed, getting file from URL(http://https://www.exemple.com//s/bx_videos_videos/hyfhstxd65w7wq4jbjegmbzdpmlzdvmb.mp4) failed
                                    
                                    
                                    

                                    I mention that I did the installation using the variable

                                    UNA_AUTO_HOSTNAME=1
                                    

                                    in .env file for the instalation proces. Returning to the original variable in inc/header.inc.php

                                    define('BX_DOL_URL_ROOT', 'https://example.com/');
                                    

                                    video transcoding works correctly and videos are processed correctly

                                    • Hello @ORV !

                                      It seems this construction

                                      ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') ? 'https' : 'http') . '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'https://example.com/') . '/'
                                      

                                      gives the less '/' symbol at the end of the URL. It looks so by your provided log.

                                      • To define the BX_DOL_URL_ROOT constant correctly, make sure the URL construction is complete and all parentheses are closed. In your current versions, there is a syntax error in the second variant due to a missing closing parenthesis.

                                        Correct Version:

                                        define('BX_DOL_URL_ROOT', ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') || (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') ? 'https' : 'http') . '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'www.exemple.com/') . '/');
                                        

                                        Checking the scheme:

                                        • (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'): If the connection is secure (HTTPS).
                                        • (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'): If the forwarded protocol is HTTPS.
                                        • (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on'): If SSL is on.

                                        Constructing the scheme:

                                        • If any of the above conditions are true, the scheme is https, otherwise http.

                                        Constructing the host:

                                        • isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'www.exemple.com': If HTTP_HOST is set, use it, otherwise use www.exemple.com as the default value.

                                        Adding a trailing slash:

                                        • . / '`' adds a trailing slash to the URL to ensure correct formatting.

                                        Your fragment has a syntax error (missing closing parenthesis at the end) and should be corrected. However, it seems that you were right, I omitted to add this character "/" to the end of my domain name i wil check it out again. Big thank you.

                                        Login or Join to comment.