Last active
November 13, 2017 15:16
-
-
Save mauricerenck/050d4a6ea674ce91241e559298a37ad2 to your computer and use it in GitHub Desktop.
[Shopware] Get Image Path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = ltrim($path, "/"); | |
$path_elements = explode("/", $path); | |
$path_info = pathinfo($path); | |
$path_md5 = md5($path); | |
$path = array_slice(str_split($path_md5, 2), 0, 3); | |
$path = $path_elements[0]."/".$path_elements[1]."/".join("/", $path)."/".$path_info['basename']; | |
$path = '//'.$_SERVER['HTTP_HOST'].'/'.$path; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment